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

time_from_decimal_day mktime #2

Open
KammutierSpule opened this issue Apr 6, 2024 · 1 comment
Open

time_from_decimal_day mktime #2

KammutierSpule opened this issue Apr 6, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@KammutierSpule
Copy link

I'm not sure if this is working as expected:

  struct std::tm epoch = {0};
  epoch.tm_isdst = 0;
  epoch.tm_sec = epoch.tm_min = epoch.tm_hour = epoch.tm_mon = 0;
  epoch.tm_mday = 1;
  epoch.tm_year = 70;
  time_t local_tz_offset = mktime(&epoch);
...
  return mktime(&t) - local_tz_offset;

I'm getting local_tz_offset -3600 on my computer.

but the thing is that mktime looks is not following the timezone offsets.
In fact, what was correct to me, was to not use this local_tz_offset adjust.
Now because of the - (-3600) it gives me +1hour

@KammutierSpule KammutierSpule added the bug Something isn't working label Apr 6, 2024
@KammutierSpule
Copy link
Author

I found this related blog post, maybe useful to anyone:
http://kbyanc.blogspot.com/2007/06/c-converting-struct-tm-times-with.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant