News for hackers. Stuff that matters.
Re:What every programmer should know about time by roel_v on Monday July 04, 2011 @04:36AM (#2725843)
Yes, very correct! I hope the 'lets just use Unix timestamp because it's easy' mentality will go away soon!
Re:What every programmer should know about time by wladimir on Monday July 04, 2011 @07:35AM (#2726217)
Unix timestamps are indeed easy and good enough for most cases (isn't the mantra "keep it simple"?), except for calendars/recurring events, as some people have pointed out.
Re:What every programmer should know about time by peteretep on Monday July 04, 2011 @05:38AM (#2725982)
What would you replace it with for storing a single date?
Re:What every programmer should know about time by roel_v on Monday July 04, 2011 @06:09AM (#2726043)
Depends on the context it's used in. Usually YYYY-MM-DDThh:mm:ss of ISO 8601, explicitly extend it with the UTC timezone (with the + notation), sometimes that plus the local timezone in a separate column/field, sometimes a serialized version of a library representation of a date.
Re:What every programmer should know about time by dirtyaura on Monday July 04, 2011 @06:38AM (#2726121)
UTC is fine for single events. For the recurring events, UTC + timezone alone is useless, you need to know the DST rules too to make correct calculations over the DST changes.

vCal has spec for DST rules, but you don't want to store them for every event. You store a location or "DST zone" of your event and have DST rules in separate database (they need to be updated as DST rules can change)

When I worked on calendar applications, there was not commonly agreed way to transfer DST zones between systems, but single DST rules could be transferred as part of vCal entry.

Microsoft apparently implemented their own integer code for every "DST zone" and used it to transfer events correctly between Microsoft systems (e.g. sending meeting invitations by email from Outlook to Outlook). Things might have changed since I worked on this area, I haven't checked the current status.