6 ms·
Some views on having your system timezone set to UTC
- Okkef 7y agoAnd then you got customers in another timezone and suddenly you're in a big mess.
- rubatuga 7y agoCustomers? He works at the University of Toronto.
- fotbr 7y agoMany universities these days have students scattered around the world in various distance education programs, or have students/staff/faculty at various other locations doing research in collaboration with other labs, facilities, etc. Then there are their research partners, which again may be scattered around the world, etc. So, no not customers in the traditional sense, but they depend on University services, and many of them are paying for the privilege.
- userbinator 7y agoUnfortunately, it seems most people don't understand UTC. For a brief period, when talking to customers and other employees who I knew were in another timezone, I would always refer to times in UTC, e.g. 14:30 UTC. A lot of them didn't understand and either got the maths wrong or thought I was referring to their timezone, which is why I stopped doing it. They would rather use their timezones or mine.
- swiley 7y agoOne issue I’ve had with having my local machine on UTC is that people in the same time zone won’t always specify the time zone and things like mail clients will guess and automatically convert times. I gave up after missing meetings a couple times this way.
- sneak 7y agoHaving clocks around for local and UTC and CET and EST/PST and JST means you internalize the offsets really quickly and get a good feel for the ball spinning in space. Make it so that whenever you see your local clock, you see all the clocks.
- speedgoose 7y agoEven though you don't like to do an addition, I think you must use UTC on servers. It is for example better to use the UTC timezone when you complain to your cloud provider with a support in another timezone. It can also help to find poorly developed software that ignores timezones before it's too late.
- chrisdbanks 7y agoOne issue with having your servers not in UTC will be that you're always wondering whether other software e.g. logging software is using UTC or local time. Also, in your database you should always use UTC if you have daylight saving time or else you might have surprising issues where records are out of order by date during time changes. Also, what happens when you start a collaboration with a university in another country and suddenly have users in another time zone. As someone who's worked on many projects with timezones I've seen many people make arguments for not using UTC. Something always comes along that makes them wish they'd used UTC. If you use UTC for everything then you're always sure it's UTC, and it's easy to make the conversion. Otherwise you're always unsure and the costs of uncertainty can be very high indeed.
- zrm 7y agoUnix does the sensible thing and records timestamps in seconds since the epoch. The epoch is always 1970 January 1 00:00:00 UTC. Timestamps in logs and sent over the wire in that format then don't have a timezone encoded because the "timezone" only gets applied when converting to a format that encodes time of day. When used as a wire format this also allows every device to display the time in its own timezone.
- zokier 7y ago> Unix does the sensible thing and records timestamps in seconds since the epoch. If only, but unfortunately that's not how UNIX time works. Instead its more like number of days since epoch * 86400 + seconds since midnight. Which is 27 seconds different than simple seconds since epoch count. This is why I would advise against using UNIX timestamps for anything critical because they are fundamentally ambiguous
- zrm 7y ago> Instead its more like number of days since epoch * 86400 + seconds since midnight. Which is 27 seconds different than simple seconds since epoch count. Yeah, the people who decided to do that were Wrong. Fortunately it only really matters during leap seconds, and nothing stops you from doing it the right way and having your timestamps in actual seconds since epoch and then converting to "Unix time" or anything else you need. See e.g. libtai: https://cr.yp.to/libtai.html https://cr.yp.to/libtai.html
- kogir 7y agoI’d argue that the only time you shouldn’t use UTC is when you live in UTC. The point is mainly to ensure that your code and institutional processes handle time zones correctly by ensuring nothing accidentally works correctly if they don’t. Whatever you do pick, you definitely want to avoid Daylight Savings Time because it’s not just twice a year - it’s a different twice a year depending on which years (laws enacted it, and have moved it multiple times).
- gerikson 7y agoWho lives in UTC?
- 2038AD 7y agoIceland
- gerikson 7y agoIceland is on GMT/Western European Time, which is a civil timezone that would allow the implementation of a future DST. It just happens to be +00:00 to UTC all year right now. Iceland had DST in the 1960s.
- 2038AD 7y agoEven more reason for someone there to be careful with timezones!
- gerikson 7y agoTrue. People I correspond with in the UK have the tendency to just say "1PM GMT" all year round, and I have to infer they're actually referring to "whatever the local time is in the UK at the moment", not specifically UTC+0 in summer. The UK had "Double Summer Time" during WW2, and I believe again in the 1970s. Granted that was before computers but still.
- doctor_eval 7y agoThere are two problems here. In my experience most people, including most developers but perhaps excluding many HN readers, don't understand what the timezone setting does. The time on all contemporary computers is always Unix Epoch Time, which is close to (but not exactly) UTC. Setting your timezone doesn't actually change anything about how time works on the computer. It just changes how time is printed. That's it. So the second problem is that our text-based server world, for all its benefits, doesn't cope well with per-user parameters. I mean ... timezone support on Unix is basically buggy. It doesn't matter what TZ I set in my .profile, nevertheless the timezone of logs is in whatever TZ the server is running in. That's pretty stupid. And even simple calculations like "how many seconds elapsed between this log entry and this one" - which is really common - are very difficult, regardless of the TZ setting. In my own personal perfect world, all logs would be printed in the first column of log files using the epoch time in seconds, and we'd have a command which would convert from the epoch time to the local timezone. So we could do something like: tail -f /var/log/messages | grep 'panic' | timestamp ...in which case I would be able to choose the timezone and format of the timestamps to meet the needs of the job i was doing. So for me, this whole argument over UTC is dumb. It doesn't matter what timezone the system is set to; any zone can be "default". The real problem is that different users have different time formatting requirements, and to date we haven't had tools which deal with that properly. (even logging all timestamps consistently in ISO format would be a big step up...)
- jasonjayr 7y agoYou may already know this, but runit's svlogd[1], and djb's daemontool's multilog[2] prefix log lines with tai64[3] timestamps [1] http://smarden.org/runit/svlogd.8.html http://smarden.org/runit/svlogd.8.html [2] https://cr.yp.to/daemontools/multilog.html https://cr.yp.to/daemontools/multilog.html [3] https://cr.yp.to/libtai/tai64.html https://cr.yp.to/libtai/tai64.html
- globular-toast 7y agoThere are major pitfalls with using local time, unfortunately. The big one is printing timestamps without the time zone which gives you ambiguous timestamps around the daylight savings time switch. But it's absolutely fine to record timestamps in local time as long as you record the time zone too. You can even randomly switch your time zone throughout the day if you want. Doesn't matter. Your theoretical tool would still work as long as a standard format like ISO8601 is used (also unambiguous wrt leap seconds, unlike Unix). I think the insistence on UTC is a case of "a little knowledge". What happens is some developer somewhere has to learn the hard way about time zones. Now he could either learn about the problem in depth or he finds the shortcut solution: just use UTC. He's now unlikely to ever get bitten again, but he never really learnt what the problem was. He now tells other developers to use UTC and many will blindly follow. In that way it's a bit like the whole insistence on spaces over tabs. Another instance of "a little knowledge" and losing the power of the tab character as a result.
- jedberg 7y agoA trick I learned a very long time ago — I set all my servers to Arizona time. They don’t have daylight savings time. Since I’m on the west coast, 7.5 months of the year we’re in the same time zone and for the other 4.5 it’s not hard to subtract 1. Crons don’t really need adjustment with the time change in pacific because off peak is still off peak.
- dmlittle 7y agoA lot of systems let you choose what timezone you want to use in their UI and you can choose to use your local timezone or UTC. We log everything in UTC but I can still filter or even display logs with my local timezone without any issues or major complications.
- fooblat 7y ago> In fact I think we are a great example of a worst case for using UTC as the system timezone. I don't understand this at all. I have run all servers in UTC for as long as I can remember. I've run a few teams with very large server fleets. Understanding that the time reported by a user needs to be converted is just part of the job. It becomes second nature quickly. Even if all your users are in your local timezone, you will inevitably need to interact with vendors and systems in other places. I don't get what calamity the author thinks they are avoiding.
- nullc 7y agoIn whatever cron fedora is shipping these days, you can throw TZ= statements in them to run events in other timezones... pretty useful when you need to track DST on a system which is otherwise all UTC.
- chucky 7y agoThe reason I would argue for always using UTC is that local time in a time that has timezones isn't clearly unambiguous. In fall, when you set the clock back an hour, suddenly the time 02-03 in the morning happens twice. So if you have an event at 02:13, it could have happened at either of the two 02:13's that happened during that night, and since you are using server local time, you won't necessarily be able to know which one afterwards. Whether being able to figure this out afterwards is important depends on your use case, of course.
- ithkuil 7y agoThat's only a problem if the recorded (or rendered) date format doesn't include the timezone
- kd5bjo 7y agoUTC also has this problem, to a lesser degree. The length of its second is determined atomically, but it’s also guaranteed to stay within 0.9 seconds of solar time. Individual seconds are either skipped or repeated to maintain this guarantee in the face of solar clock drift. (cf. https://en.m.wikipedia.org/wiki/Leap_second https://en.m.wikipedia.org/wiki/Leap_second )
- zokier 7y agoIn UTC leap seconds are not ambiguous because seconds are not repeated > The extra second is displayed on UTC clocks as 23:59:60. Note how it's not 23:59:59 repeated, and thus fully unambiguous
- lonestar101 7y agoWhen we were implementing an ERP solution to a manufacturer based in PST and factories situated in China, we faced period close issues since our servers were in PST timezone and factories in China had to wait for around half a day to have the next period open. Switching to UTC has actually made the different timezones overlap and reduced overtime efforts. Anyone here faced similar issues?
- mattlondon 7y agoThis is a common view I've seen. It usually starts like this " but we're all in <tz> so we should just use that so no one needs to do any maths." Then later when operations spread to elsewhere it becomes "but most stuff is still done in <original tz> so we will still use that and everyone in other places will just need to deal with it and use our 'real' tz." Then when you are operating in 3 or 4 or 5 or more locations it is too late to change anything and you are screwed because now you are in some provincial timezone for 50% of your systems - complete with clock changes - and the rest are a mess of either in UTC or some other TZ local to that server with their own different clock changes to the original TZ. Chaos. And you can guarantee that none of the log files have TZ in their timestamps because of that original "we're only in one TZ" mindset so why bother saying what TZ it is... From then on every time you look at a log or a database or a web UI or whatever you need to double guess the timezone. For those that come after you, please please please if you can't use UTC then at the very least always show the timezone in your log files/UIs/etc even of it seems redundant at the time - in the future someone handling an incident or trying to fix a P1 bug on a Friday afternoon will thank you.
- rini17 7y agoI have my doubts, having witnessed the repeated confusions between americans (who mindlessly spew out times in like EST, hey, it's called "standard") and non-americans who then try to convert using google which was not always correct, esp. when they forget about am/pm.
- bloak 7y agoThe only sensible alternative to UTC for the system time is TAI, but I don't know of an OS that lets you use TAI for everything. Perhaps some specialist OS used for satellites? Being able to take the difference of two numerical values to determine the elapsed time, without having to worry about leap seconds, would be so much simpler. You could convert to UTC for display purposes, when possible. It's not always possible for times in the future, but that's a concept people are already used to: you can't reliably convert a future time stamp between local time zones, either.
- BrandoElFollito 7y agoWhat's wrong with the ISO format? If you are lucky it shows your wall clock time. If you are not lucky you need to do take into account the shift, which is part of the string.
- badrabbit 7y agoYou should always set it to UTC regardless. User interfaces can use local time zone. Even if you're a small mom-n-pop shop, good engineering is long term planning. Let's say you get some 3rd party managed appliance and you work with their techs to troubleshoot an issue, or host something in the cloud but all the stackdriver/cloudtrail is not on your local time. Just use UTC until you have a specific reason not to,even then do it at the user/setting level not a system wide default.
- karmakaze 7y agoThe best reason for running a system in UTC is that you do want to present dates & times in a user preferred timezone. When you have users in more than one timezone as you do with any internet service, then you substantially reduce your chances of errors if you only convert once and not between two non-UTC timezones. Edit: The other thing about examining logs is that I don't care what local time it occurred. Once an incident is identified all I care about is the time of the incident which can all be in UTC, my mind is at those hours while reading logs from every source.
- symgryph 7y agoYou can tell that this guy has never had support systems in 30 different countries. UTC From a security perspective is almost a requirement. Date time offsets can dramatically increased amount of time that a root cause analysis of a compromised system. If you are a small business in one time zone sending things to local time is fine. But if you were a large multinational setting time to anything but UTC is a disaster waiting to happen.