timer:now_diff/2 documentation inconsistency

Nils Müllner nils.muellner@REDACTED
Tue Feb 28 08:44:44 CET 2006


>
> Here's the result type we get in the shell:
>
> $ erl
> Erlang (BEAM) emulator version 5.4.12 [source] [hipe] [threads:0]
>
> Eshell V5.4.12  (abort with ^G)
> 1> now().
> {1141,85623,555497}
> 2> timer:now_diff(now(), v(1)).
> 12178593
hi,
didn't know there was now_diff/2 ;-) i used sth like

StartTime = now(),
StopTime = breakCipher(EnCipher, FirstKey, IVec, Text),    %%%   returns 
now() when keypair is found

    {StartVekA,StartVekB,StartVekC} = StartTime,
    {StopVekA,StopVekB,StopVekC} = StopTime,
    ResVekC = StopVekC - StartVekC,
    ResVekB = StopVekB - StartVekB,
    ResVekA = StopVekA - StartVekA,
    if
        ResVekC < 0 ->
            ResVekCNew = ResVekC + 1000000,
            ResVekBNew = ResVekB - 1;
        true ->
            ResVekCNew = ResVekC,
            ResVekBNew = ResVekB
    end,
    if
        ResVekBNew < 0 ->
            ResVekBNewNew = ResVekBNew + 1000000,
            ResVekANew = ResVekA - 1;
        true ->
            ResVekBNewNew = ResVekBNew,
            ResVekANew = ResVekA
    end,
    ResultTime = {ResVekANew,ResVekBNewNew,ResVekCNew},
    ResultTime.

this should work.
kind regards
nils



More information about the erlang-questions mailing list