Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function get localtime in binary built by nix work incorrectly #89487

Closed
thongpv87 opened this issue Jun 4, 2020 · 4 comments
Closed

Function get localtime in binary built by nix work incorrectly #89487

thongpv87 opened this issue Jun 4, 2020 · 4 comments
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: non-nixos Running packages on non-NixOS Linux

Comments

@thongpv87
Copy link

thongpv87 commented Jun 4, 2020

Describe the bug
Function get localtime in binary built by nix work incorrectly

To Reproduce
Steps to reproduce the behavior:
I have written a simple project at https://github.com/thongpv87/nix-test . The code in main.cpp set the TZ environment variable then call function localtime and print the timezone. Compile this file with g++, nix-build, g++ in docker image by dockerfile, docker image from dockerTools and run these binary/image and compare the result.

My host system time zone is Singapore. The current time in Singapore when I run this is 23:48:40. The output when run with binary from nix-build is:

TZ=(null)
Current local time and date: Thu Jun  4 23:48:25 2020
 
TZ=America/New_York
Current local time and date: Thu Jun  4 15:48:25 2020
 
TZ=Asia/Tokyo
Current local time and date: Thu Jun  4 15:48:25 2020
 
TZ=Europe/London
Current local time and date: Thu Jun  4 15:48:25 2020

More output: https://pastebin.com/t8FAixyL

Expected behavior

TZ=(null)
Current local time and date: Thu Jun  4 23:48:40 2020
 
TZ=America/New_York
Current local time and date: Thu Jun  4 11:48:40 2020
 
TZ=Asia/Tokyo
Current local time and date: Fri Jun  5 00:48:40 2020
 
TZ=Europe/London
Current local time and date: Thu Jun  4 16:48:40 2020

Notify maintainers

Metadata

  • system: "x86_64-linux"
  • host os: Linux 4.15.0-70-generic, Ubuntu, 16.04.6 LTS (Xenial Xerus)
  • multi-user?: no
  • sandbox: yes
  • version: nix-env (Nix) 2.3.4
  • channels(gitlab-runner): "nixpkgs-20.09pre213040.f77e057cda6"
  • channels(root): "nixpkgs-20.09pre213040.f77e057cda6"
  • channels(tpham): "home-manager, nixpkgs-20.09pre228165.00df2371122"
  • nixpkgs: /home/tpham/.nix-defexpr/channels/nixpkgs
@thongpv87 thongpv87 added the 0.kind: bug Something is broken label Jun 4, 2020
@matthewbauer
Copy link
Member

This looks like the same issue as #65415.

@veprbl veprbl added the 6.topic: non-nixos Running packages on non-NixOS Linux label Jun 5, 2020
@stale
Copy link

stale bot commented Dec 2, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 2, 2020
@aanderse
Copy link
Member

Any update on this?

@fpletz
Copy link
Member

fpletz commented Dec 14, 2021

Duplicate of #65415.

@fpletz fpletz closed this as completed Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: non-nixos Running packages on non-NixOS Linux
Projects
None yet
Development

No branches or pull requests

5 participants