Skip to content

Add a convenient way to get the Milliseconds between two Instants #98

Closed
@i-am-the-slime

Description

@i-am-the-slime

This is a use case I have often when timing things.
I would like to avoid running unInstant in application code.

Maybe like this:

-- | Get the amount of milliseconds between the first and second Instant
-- | for example:
-- | ```
-- | do
-- |   start <- Instant.now
-- |   aLongRunningEffect
-- |   end <- Instant.now
-- |   let duration = Instant.delta end start
-- |   log ("A long running effect took " <> show duration)
-- | ```
delta  Instant  Instant  Milliseconds
delta i1 i2 = (unInstant i1) <> negateDuration (unInstant i2)

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