A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.
I'm sure someone else has had this issue. We are configuring tasks to run on in an Oracle/UNIX environment. Just occasionally, a customer will configure a task to run at a time which actually doesn't exist. In other words, in the gap between 1am and 2am when the clocks go forward for summertime.
In the UK the time that this happens is defined by a standard, but clearly that differs around the world and our software has a global market.
Does anyone know of a UNIX or Oracle function that will tell you whether a specific time is a real time in the context of your server's locale and daylight saving time settings? Note that we are multi-platform too, so if there is a function in SPUDLIX which only works on the Foobar 2940, that would be interesting, but not much.
Impetunious the Voidwalker
Tuesday, June 28, 2005
Pass the target time to mktime, and pass mktime's result to localtime. If you get the same time back from localtime that you passed to mktime, then it's a valid time. Otherwise it's invalid (because of DST or because it had a bogus value, like the June 31st).
Tuesday, June 28, 2005
You might consider redefining '2 am' as '2 hours past midnight'.
If not, your 1:30 am task will be run twice in the fall ;-)
Wednesday, June 29, 2005
I'm a big fan of UTC (aka GMT - don't ask me for the details, I'm a fan not an expert).
All times, regardless of location/timezone/daylight savings, are guaranteed to actually exist, and if you're a timezone away you can still synchronise easily.
So, you set the task to run at 18:30UTC, and if that happens to be half an hour after the daylight savings switch, noone cares - the task went at the scheduled time.
If you want something to run '3 hours after local midnight' then you're pretty much guaranteed to need an encoding that specifies "local 00:00 + 3 hours" rather than a fixed time of day, if only because governments muck around with the calendar just enough to make it impossible for software to keep up. Even the UK will, sooner or later, be difficult and change their daylight savings times out from underneath you, no matter how 'standard' they are.
Of course, user displays should be able to convert to local time as necessary.
Thursday, June 30, 2005
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz