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

Unable to control time zone #96

Closed
qtplatypus opened this issue Apr 7, 2020 · 4 comments
Closed

Unable to control time zone #96

qtplatypus opened this issue Apr 7, 2020 · 4 comments

Comments

@qtplatypus
Copy link

After reviewing the documentation it isn't clear how one sets the time zone to be used.

@taraspos
Copy link
Collaborator

taraspos commented Apr 7, 2020

Hey,
can you please explain what is your use-case?
Where do you need timezone to be set, on Ofelia itself or maybe in the scheduled container?

@qtplatypus
Copy link
Author

the use case is that we are porting a non containerised system that uses cron to a container based system using Ofelia to do the scheduled events. In the cron based system we have the timezone set in the cron configuration in order to ensure that the times that the scheduled events happen are done in the correct time zone.

The place I need the timezone to be set is in the location ofelia uses to determine what time zone it is when deciding when to do a thing.

@taraspos
Copy link
Collaborator

taraspos commented Apr 8, 2020

Scheduling is done by https://pkg.go.dev/github.com/robfig/cron.

Documentation says:

Time zones
All interpretation and scheduling is done in the machine's local time zone (as provided by the Go > time package (http://www.golang.org/pkg/time).

Be aware that jobs scheduled during daylight-savings leap-ahead transitions will not be run!

So technically, setting env variable TZ=Africa/Cairo for the Ofelia container should do the trick, however, I didn't try that myself. Can you try and let me know if that works?

@aaronkollasch
Copy link

It should also be possible to pass the host's local time by mounting the /etc/localtime file, e.g. -v /etc/localtime:/etc/localtime:ro. It looks like the Go > time package's Local location is aware of /etc/localtime, but I haven't tested if Ofelia uses it yet.

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

No branches or pull requests

3 participants