TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The need for timezone awareness

52 pointsby lautabout 10 years ago

13 comments

emptybitsabout 10 years ago
Trivia questions, easily answered by programmers who appreciate the subtleties of time math:<p>1. If someone leaves Vancouver at 1 am and arrives in Seattle at 4 am on the same day, and you know the distance they travelled is 240 km, what was their average rate of speed? (Correct answer: 120 km&#x2F;h, 80 km&#x2F;h, or 60 km&#x2F;h, depending on what day it is. UTC storage helps here.)<p>2. If it&#x27;s noon in Vancouver, what time is it in London, England? (Correct answer: 7 pm, 8 pm, or 9 pm, depending on what day it is. Knowledge of regional DST schedule differences helps here.)<p>It&#x27;s my experience that when the programmers get date math <i>correct</i>, they may still find themselves fielding &quot;bug&quot; reports from enterprise customers who <i>should</i> understand the concept but don&#x27;t (particularly if their business is billing or rate calculation -- think of short term billing for hourly parking or CPU hours as an example).
评论 #9525608 未加载
firegrindabout 10 years ago
I watch Tom Scott&#x27;s &quot;The Problem WIth Time And Time Zones&quot; from time to time just as a reminder<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=-5wpm-gesOY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=-5wpm-gesOY</a>
评论 #9524863 未加载
loudmaxabout 10 years ago
In my experience, the simplest way to program with times and dates is nearly always to convert to Unix epoch as early as you can in the process. Do all processing in Epoch, then convert back to something readable by humans at the last possible moment. This approach won&#x27;t work in all circumstances, but it should be the standard approach unless there&#x27;s a compelling reason not to.
评论 #9525641 未加载
评论 #9525497 未加载
评论 #9525359 未加载
评论 #9525173 未加载
评论 #9525479 未加载
oulipianabout 10 years ago
Try living in a time zone that is a half-hour deviation from standard time (Newfoundland &amp; Labrador). When I first got an iPod my time zone simply wasn&#x27;t supported by the software: <a href="https:&#x2F;&#x2F;discussions.apple.com&#x2F;thread&#x2F;179539" rel="nofollow">https:&#x2F;&#x2F;discussions.apple.com&#x2F;thread&#x2F;179539</a>
评论 #9524936 未加载
Roritharrabout 10 years ago
Living in germany I often times have to raise eyebrows at the basic assumptions american coders often have with regards to encoding, timezone awareness and other common defaults.<p>An american friend with french heritage noticed happily after moving to germany that the accent de gue on his last name was finally printed correctly on his mail and packages.
评论 #9525186 未加载
评论 #9524851 未加载
评论 #9525478 未加载
lucb1eabout 10 years ago
Well that answers the question I&#x27;ve been asking people for years: why do people keep using PST when everyone in the world understands UTC+&#x2F;-X but nobody has a timezone table in their heads? Well, timezones change (using summertime or not changes the most).
评论 #9525580 未加载
评论 #9525469 未加载
a3nabout 10 years ago
Time is huge. You cannot get it right in all cases. You can only get it right for your particular case. If you try to get it right for all cases, you waste resources on something that mostly doesn&#x27;t matter, and dwarf your other resources.<p>Time is not just calendar apps, or cron. Consider relative dates in historical studies that span past, present and future.<p>Study the fuck out of your use case, get it right, don&#x27;t worry about others&#x27; opinions and don&#x27;t think that your solution applies generally to most other use cases.<p>Also, among the many resources for general and specific solutions to time problems is &quot;Calendrical Calculations,&quot; by Dershowitz and Reingold. I found it randomly, bought it on a lark, and hope to $DEITY I never haver to care about time for anything critical.<p><a href="http:&#x2F;&#x2F;www.worldcat.org&#x2F;search?qt=worldcat_org_all&amp;q=calendrical+calculations" rel="nofollow">http:&#x2F;&#x2F;www.worldcat.org&#x2F;search?qt=worldcat_org_all&amp;q=calendr...</a>
评论 #9526086 未加载
robmcmabout 10 years ago
I find most people doen&#x27;t understand the difference between timezone and time offset.<p>I reciently had a huge issue trying to explain to people why we couldn&#x27;t (easily) show the offset next to the city on a date time input, because we didn&#x27;t have a native library to do it. They couldn&#x27;t grasp that a date in the future could have a different offset for the same city and that they didn&#x27;t all change at the same time.<p>If anyone is using JS checkout moment.js and also be aware that date objects in most client side runtimes are in the users timezone by default, and often doen&#x27;t let you change the offset.
leni536about 10 years ago
According to cron&#x27;s man page on Debian the &quot;fix&quot; that makes cron work on DST is &quot;Debian specific&quot;. What happens on other distributions?<p>On Debian: <a href="http:&#x2F;&#x2F;debian-handbook.info&#x2F;browse&#x2F;stable&#x2F;sect.task-scheduling-cron-atd.html#idm139883800332112" rel="nofollow">http:&#x2F;&#x2F;debian-handbook.info&#x2F;browse&#x2F;stable&#x2F;sect.task-scheduli...</a>
评论 #9526839 未加载
评论 #9528205 未加载
protomythabout 10 years ago
I&#x27;m pretty sure we had a big discussion on this a couple of months ago, but I cannot find the link.<p>Don&#x27;t forget that for a lot of applications your users don&#x27;t care about time zones. &quot;I have a meeting every Monday morning at 10:00AM and some folks from around the world call in&quot;. Its up the the programmer to figure that out for all involved.
azurelogicabout 10 years ago
This was our topic from our local dev meetup last month. We have a video of it here: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZQAELeiY68E" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZQAELeiY68E</a>. Interesting discussion of weird time bugs too.
lorenzfxabout 10 years ago
Even when using a library that supports timezones (and DST), handling them is still a pain, especially if one has to deal with timezone aware and <i>floating</i> datetimes at the same time.
Olap84about 10 years ago
Its not just your code that needs timezone awareness, users are all shockingly bad at understanding timezones. Daylight savings in particular needs to die.
评论 #9525767 未加载
评论 #9525674 未加载