[Haskell-beginners] Storing the time difference between two Monotonic time results

David McBride toad3k at gmail.com
Mon Jul 9 13:21:05 UTC 2018


I guess whatever version you are using did not export that function.  In
any case the definition for that function is incredibly simple, so you
could just write your own for now.

diffTimeSpec :: TimeSpec -> TimeSpec -> TimeSpecdiffTimeSpec ts1 ts2 =
abs (ts1 - ts2)



On Mon, Jul 9, 2018 at 9:08 AM, Awsaf Rahman <awsafrahman1704 at gmail.com>
wrote:

> I imported the System.Clock module and tried to use the diffTimeSpec
> function but it keeps saying "out of scope".
>
> On Mon, Jul 9, 2018 at 2:45 PM, David McBride <toad3k at gmail.com> wrote:
>
>> There is a diffTimeSpec function in that module that seems like it would
>> work.
>>
>> On Mon, Jul 9, 2018 at 8:30 AM, Awsaf Rahman <awsafrahman1704 at gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> I am trying to time a function I have written in haskell using the clock
>>> package in the following way:
>>>
>>> *start <- getTime Monotonic*
>>> *evaluate(something)*
>>> *end <- getTime Monotonic*
>>> *fprint (timeSpecs % "\n") start end*
>>>
>>>
>>> Now what I want is to store the time difference between *start* and *end.
>>> *Is there a way I can do that?
>>>
>>> Regards
>>> Awsaf
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>>
>>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180709/ca067997/attachment.html>


More information about the Beginners mailing list