Rev 1653 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1653 | Rev 1701 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | /** POSIX gettimeofday |
57 | /** POSIX gettimeofday |
58 | * |
58 | * |
59 | * The time variables are memory mapped(RO) from kernel, which updates |
59 | * The time variables are memory mapped(RO) from kernel, which updates |
60 | * them periodically. As it is impossible to read 2 values atomically, we |
60 | * them periodically. As it is impossible to read 2 values atomically, we |
61 | * use a trick: First read a seconds, then read microseconds, then |
61 | * use a trick: First read a seconds, then read microseconds, then |
62 | * read seconds again. If a second elapsed in the meantime, read |
62 | * read seconds again. If a second elapsed in the meantime, set it to zero. |
63 | * useconds again. This provides assurance, that at least the |
63 | * This provides assurance, that at least the |
64 | * sequence of subsequent gettimeofday calls is ordered. |
64 | * sequence of subsequent gettimeofday calls is ordered. |
65 | */ |
65 | */ |
66 | int gettimeofday(struct timeval *tv, struct timezone *tz) |
66 | int gettimeofday(struct timeval *tv, struct timezone *tz) |
67 | { |
67 | { |
68 | void *mapping; |
68 | void *mapping; |