4 ms·
Use "unixtime" ints anywhere you deal with times programmatically and set the TZ to whatever you like...imho the TZ setting is for human benefit, so humans shou
by karma_vaccum123 10y ago
Use "unixtime" ints anywhere you deal with times programmatically and set the TZ to whatever you like...imho the TZ setting is for human benefit, so humans should feel free to change it.
- jjnoakes 10y agoThis is of course the right solution in theory, but in practice, tools you don't have much control over use local time, not UTC, when interacting with the user. Cron is one example. It isn't trivial or intuitive to set up your crontabs in UTC; it should be, because that makes the most sense on a server (especially during DST transitions), but since it isn't, you either have to set your system time to UTC (as the article suggests), hack around it (changing the cron program on all machines you care about), or be aware of the pitfalls (like DST transitions).
- thwarted 10y agoFrom the ISC crontab(5) man page: The CRON_TZ specifies the time zone specific for the cron table. User type into the chosen table times in the time of the specified time zone. The time into log is taken from local time zone, where is the daemon running. I use this all the time to set job times relative to a specific timezone while the server time is in UTC. It is trivial and makes setting the times largely intuitive.
- Symbiote 10y agoI tried this for a while, but it was more confusing. Logfiles would be written with UTC times, but the time showing on my terminal prompt, or if I ran `date`, was in my local time. (Possibly more confusing to me, as I live in Western and Northern Europe, with +0000, +0100 and +0200, so it's easy not to notice the time is offset from UTC in a logfile.)