[PATCH] D92902: [llvm-elfabi] Add flag to keep timestamp when output is the same

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 00:18:49 PST 2021


jhenderson added a comment.

In D92902#2529030 <https://reviews.llvm.org/D92902#2529030>, @haowei wrote:

> I think I figured out the issue we saw. My local timezone is GMT-8 while @hans and @gargaroff are probably at GMT+1 . When touch is supplied with a time stamp `197001010000` it interpret ate it as local time, so the actual UTC time on my machine would be 197001010800 while on your machines it would be 196912312300, which is probably not valid based on how unix time work. I tried to modify my time zone  to GMT+1 and I encountered the same issue:
>
>   C:\Users\Zero\Downloads\GnuBin\GetGnuWin32\bin>touch -m -t 197001010000 foo
>   touch: invalid date format `197001010000'
>
> If I use 197001011200, it works fine:
>
>   C:\Users\Zero\Downloads\GnuBin\GetGnuWin32\bin>touch -m -t 197001020000 foo
>   
>   C:\Users\Zero\Downloads\GnuBin\GetGnuWin32\bin>
>
> So I think the fix would be just modify the timestamp used in the test from `197001010000` to `197001020000`. It should work anywhere in the world.

llvm-ar already has existing tests that use touch to create a file with a given timestamp. Take a look at `llvm\test\tools\llvm-ar\replace-update.test` for example. There are probably others - grep for `touch` in the test directory, but I think that example should be sufficient. Basically it uses `env` to set a specific timezone (GMT in this case).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92902/new/

https://reviews.llvm.org/D92902



More information about the llvm-commits mailing list