[lkml]   [2002]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: gettimeofday problem
    John Alvord wrote:
    > Maybe this is the result of floating point rounding errors. Floating
    > point is notorious for occaisional strange results. I suggest redoing
    > the test program to keep all results in integer and seeing what
    > happens...
    > john

    You were close.

    Programming error on my part.

    This modified subroutine does correct my test.
    Notice the (LL) cast on 1000000

    Computation was done on 32 bits integer then assign on the 64 bits integer.


    ps: It may help explain the other > 1 hour time jump I've seen in an
    other thread.

    LL GetTime (void)
    struct timeval tv;
    LL retval;
    int rc;

    while (0 != (rc = gettimeofday (&tv, NULL)))
    printf ("Wow! gettimeofday () returned %d\n", rc);

    retval = (tv.tv_sec * (LL)1000000) + (tv.tv_usec);

    return retval;
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:27    [W:0.022 / U:16.952 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site