Depending on the month of the year, you may be +1 or
+2 from the
UTC...
(it's the difference between CET & CEST)
Just professional curiosity, how would you define when daylight
saving time is enabled/disabled? There're different rules for
different countries. And some countries don't have it at all :-(
Presumably the same way the computer does it; provide a location such as
'Europe/Berlin' or 'America/Los_Angeles' and let the C library look in
its big
list of locales.
I did some brute-force testing of PHP's strtotime() implementation [for every known
timezone, on every day from 1 Jan 1970 to 31 Dec
2037, performed jumps to every day of the week, i.e. approx 250*(2037-1970)*365*7 = 43
million tests], and filed some corner-case
bugs (e.g. you ask for strtotime for a "Tuesday", and it gives you a day
that's a Friday), so I can maybe fill-in some of the rough
details here.
As I understand it, up until PHP 5.1, PHP used to use the O/S libraries for timezone
details and determining daylight savings.
However the time/date handling was completely rewritten in PHP 5.1 by Derick Rethans, so
that PHP now supplies its own timezone data
(in this large header file:
http://chora.php.net/viewvc.cgi/php-src/ext/date/lib/timezonedb.h?view=mark… ). One of
the benefits of
this is that for OSes with dodgy daylight savings/timezone handling (Windows in
particular), which brute-force testing showed to be
completely broken, you can largely avoid the O/S, and do-it-yourself, and get the same
behaviour on different platforms (which is
obviously a good thing when you're a cross-platform language). The new date/time
implementation seems much more robust, and it also
includes a mechanism whereby updated files can be dropped into place in the event of
future timezone changes (without recompiling
PHP).
And here's a weird factoid for the day: Did you know that there have been 3 occasions
in history where a day was *not* followed by
the next day in the week (e.g. a Saturday was followed not by a Sunday, but by a Monday)?
All three were caused by Pacific Island
areas (Pacific/Kwajalein, Pacific/Enderbury, and Pacific/Kiritimati) deciding that they
wanted to move from one side of the
international date line to the other, and when they moved, they simply lost a whole day.
:-)
All the best,
Nick.