Time Zones

A time zone is a region of earth that has adopted the same standard time, usually referred to as the local time.

Most time zones are exactly one hour apart. By convention, all time zones compute their local time as an offset from GMT/UTC. GMT (Greenwich Mean Time) is an historical term originally referring to mean solar time at the Royal Greenwich Observatory in Britain. GMT has been replaced by UTC (Coordinated Universal Time), which is based on atomic clocks. Due to political and geographical practicalities, time zone characteristics may change over time. For example, the start date and end date of daylight savings time may change, or new time zones may be introduced to handle the needs of newly created countries. For all purposes, GMT and UTC are equivalent. For details about GMT and UTC, see the U.S. Naval Observatory web page: http://www.usno.navy.mil/USNO/astronomical-applications/astronomical-information-center/world-tzones.

Internally, Sybase CEP always stores timestamp information as a number of microseconds since midnight January 1, 1970 GMT. When data is converted from internal format to external format (for example, to a string in a form such as "YYYY-MM-DD HH24:MI:SS.FF"), Sybase CEP takes into account the time zone and generates the correct local time (according to the clock and time zone information stored in the computer). Similarly, when converting from a string to the internal format, Sybase CEP also takes into account the local time zone and GMT. To allow you to specify information such as whether their local time zone uses daylight savings time, Sybase CEP provides a time zone "database" that customers can customize. You may need to change this database under certain circumstances, including:

Other customizations are also possible.

Sybase CEP's time zone database is in the form of a CSV file named c8_timezones.csv, which contains one row per time zone. The Sybase CEP Server and Sybase CEP Studio each have a copy of this file in their respective plugins directories. For example, on Microsoft Windows:

C:\Program Files\SybaseC8\Server\plugins\sybasec8_timezones.csv
C:\Program Files\SybaseC8\Studio\plugins\sybasec8_timezones.csv

and on UNIX-like operating systems:

/home/<userid>/sybasec8/server/plugins/sybasec8_timezones.csv
/home/<userid>/sybasec8/studio/plugins/sybasec8_timezones.csv

The reason that the file is located in both the Sybase CEP Studio and server plugins directories is that the server and studio may be running on separate computers, and both the server and studio must interpret and display time zones. Obviously, if one time zone database file is changed, the changes should be copied to the other plugins directory(s).

Default Time Zones

Unless time zones are specified as part of timestamp information, both input and output timestamps are in local time.

Users can specify timezone information in various CCL function calls (for example, TO_TIMESTAMP()) and in some Sybase CEP SDK calls. For example:

... TO_TIMESTAMP("2002-06-18 13:52:00.123456 PST", "YYYY-MM-DD HH24:MI:SS.ff TZD") ...

In this example, "TZD" tells the function to look for a time zone designator such as the "PST" at the end of the first string. The "PST" indicates that the time zone is Pacific Standard Time, assuming that you have not changed the default abbreviations in the Sybase CEP time zone database.

You must run Sybase CEP software on machines with proper time zone configurations.

Daylight Savings Time

If you specify a particular time zone that uses daylight savings time, Sybase CEP software takes this into account. Specifically, Sybase CEP looks at the time zone database file, reads the starting and ending dates for daylight savings time, and takes those dates into account when converting times from external format to the internal timestamp format. For example, the following 2 lines produce the SAME internal timestamp, even though one line specifies PST and the other specifies PDT:

TO_TIMESTAMP("2002-06-18 13:52:00.123456 PST", 
   "YYYY-MM-DD HH24:MI:SS.ff TZD")
TO_TIMESTAMP("2002-06-18 13:52:00.123456 PDT", 
   "YYYY-MM-DD HH24:MI:SS.ff TZD")

If a time zone designator is not used, then local time is applied. Again, daylight savings time will is taken into account if the local time zone uses daylight savings time and the specified timestamp is in the time period covered by daylight savings time.

If the start and end dates for daylight savings time change, you must change the Sybase CEP Time Zone Database to take into account the new start and end dates.

Note:

The United States changed its start and end dates for daylight savings time; the change took effect in 2007. If you are using Sybase CEP Engine 4.6.2 or earlier and use U.S. time zones in any data, you should check and, if necessary, update the Sybase CEP Time Zone Database to take into account the new dates. Information about changing the database is included later in this appendix.

Transitioning from Standard Time to Daylight Savings Time and Vice-Versa

During the transition to/from daylight savings time, certain times do not exist. For example, in the U.S., during the spring transition from standard time to daylight savings time, the wall clock jumps from 01:59 to 03:00 and the time of 02:00 does not exist. Conversely, in the fall, 01:00 to 01:59 appears twice in one night because time jumps backward from 2:00 to 1:00 when daylight savings time ends.

However, because these undefined and/or ambiguous times can still be input, the Sybase CEP software has been developed to deal with them in some manner. During the transition to daylight savings time, the time from 02:00 to 02:59 does not exist as the wall clock jumps from 01:59 to 03:00. Sybase CEP will interpret 02:59 PST as 01:59 PST. In the fall, when daylight savings time disappears, ambiguous times exist because at 02:00, time jumps backwards one hour. Thus, Sybase CEP will interpret 02:00 PDT as 01:00 PST on this morning.

If you are truly concerned with these matters use GMT times, which do not include daylight savings time.

Duplicate Time Zone Abbreviations

There are many more than 24 time zones on earth. Some countries, such as India, have time zones that are not a multiple of an hour different from GMT. The Sybase CEP Time Zone database contains approximately 40 commonly-used time zones, and this is not a complete list.

In part because there are so many time zones, two or more time zones may have the same abbreviation. For example, both Australia and the U.S. use Eastern Standard Time (EST) to refer to the time zone on the eastern side of their respective countries. Because each time zone abbreviation in the Sybase CEP time zone database must be unique, Sybase CEP users in the U.S. may prefer to keep EST as a reference to U.S. Eastern Standard Time and use a different abbreviation (for example, "AEST") for Australia's Eastern Standard Time. Users in Australia, of course, may prefer to do the converse. Since Sybase CEP's time zone database is user-customizable, you can choose whatever abbreviations you wish, as long as each time zone's abbreviations do not overlap the abbreviations for another time zone.