Re: [PATCH 2/2] git-compat-util: use gettimeofday for current time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Eggert <eggert@xxxxxxxxxxx> wrote:
> Use gettimeofday instead of time(NULL) to get current time.
> This avoids clock skew on glibc 2.31+ on Linux, where in the
> first 1 to 2.5 ms of every second, time(NULL) returns a
> value that is one less than the tv_sec part of
> higher-resolution timestamps such as those returned by
> gettimeofday or timespec_get, or those in the file system.
> There are similar clock skew problems on AIX and MS-Windows,
> which have problems in the first 5 ms of every second.

Wow, this is enlightening... and unfortunate :<

I decided to check glibc archives to find more discussion on it.
So far, I've found:

  https://inbox.sourceware.org/libc-alpha/20230306160321.2942372-1-adhemerval.zanella@xxxxxxxxxx/T/

and the original bug:
  https://sourceware.org/bugzilla/show_bug.cgi?id=30200

And this is due to the time64 changes in glibc 2.31+?
(<= 2.30 isn't affected?)

<snip>

> Yet another possibility would be to fix the Linux kernel so
> that the time syscall is consistent with the other timestamp
> syscalls.  I suppose this has not been done due to
> performance implications.  (Git's use of timestamps is rare
> enough that performance is not a significant consideration
> for git.)  However, this wouldn't fix Git's problem on older
> Linux kernels, or on AIX or MS-Windows.

Agreed on the older kernels and other OSes part.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux