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

added timezone support #34

Closed

Conversation

BestITUserEUW
Copy link

added simple tests

updated README.md

added simple tests

updated README.md
@BestITUserEUW
Copy link
Author

Linux test passed Ubuntu 22.04 gcc-11.4.0
Windows test passed Windows 10 MSVC 19.34.31937.0

Windows took quite long to setup with libcurl and openssl. Looks like date-tz from date on windows uses 7-Zip to unpack the received tar ball, so it's not really straightforward using it on Windows.

README.md Outdated

Using TzClock has the following side effects:
1. Date requires linkage to `libcurl`
2. First time TzClocks timezone lookup will occur it will download the most up to date timezone: "~/Downloads/tzdata" ("%homedrive%\%homepath%\downloads\tzdata" on Windows).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking this won't work when the library is used as a Windows service as there's no home folder for the LOCALSYSTEM account. Can the download location be passed in to TzClock somehow so that the application can determine where it is downloaded? Also, what about an embedded version of the TZ database?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will have a look on Sunday if anything of the following will be possible. Setting database install path will be possible out of the box from date-tz but only at build time trough -DINSTALL=/some/path. I'm sure embedded is possible but would require a good amount of work, like different platform support (Arduino, ESP-IDF, Micro-python, Rust), either embedding db into flash at compile time or using Eeprom at runtime to store latest db, if you are targeting microcontrollers. I don't think I will have time doing all of this.

@PerMalmberg
Copy link
Owner

PerMalmberg commented Feb 22, 2024 via email

moved date-tz build to libcron

added LIBCRON_MANUAL_TZ_DB option

updated README.md

added documentation on how to set install path
@BestITUserEUW
Copy link
Author

Windows build is not working yet


[More Info about date-tz](https://howardhinnant.github.io/date/tz.html)
Setting database path / install path can be done with `date::set_install`. If not set path will default to: "~/Downloads/tzdata" ("%homedrive%\%homepath%\downloads\tzdata" on Windows).
Using TzClock without LIBCRON_MANUAL_TZ_DB requires liburl installed in your system. On Windows it will also require 7-Zip installed into the default location.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, it requires 7-zip ? Meaning it will execute it to unpack? I'll have to pull the emergency break here. This library should not execute any application, too much of a security issue the user of this library doesn't have control over.

With that in mind, we'll have to settle with using a pre-existing DB and let the library user handle management of that file.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With that in mind, the TzClock can take a path to the DB as a constructor argument and call date:set_install, ensuring it is available before the construction of the clock.

@PerMalmberg
Copy link
Owner

Closing this stale PR.

@PerMalmberg PerMalmberg closed this Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants