Skip to content

What is the most appropriate way to round a UTCTime to microsecond resolution? #277

@theophile-scrive

Description

@theophile-scrive

During tests I insert an entity in PostgreSQL (which has microsecond resolution) with a timestamp created with time (which has picosecond resolution). When I fetch the entity from the database, the timestamps obviously differ, because PostgreSQL has lower precision:

- expiration = Just 2025-08-22 11:59:23.370617513 UTC}]
+ expiration = Just 2025-08-22 11:59:23.370617 UTC}]

I have the option to tweak the record before handing it to the assertEqual funtion in my test suite. I was wondering if I could remove some precision from UTCTime in a principled way. Is that advised?

(btw, thank you @AshleyYakeley for your work on this library!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions