This class provides the information needed to determine whether Daylight Savings Time (DST; a.k.a. "Summer Time") is currently active at a given location. There are (at least) 25 different "rules" which govern DST around the world; a string identifying the appropriate rule is attached to each city in citydb.sqlite.
The rules themselves are stored in the TZrulebook.dat file, which is read on startup; each line in the file creates a TimeZoneRule object.
TimeZoneRule consists of QStrings identifying the months and days on which DST starts and ends, QTime objects identifying the time at which the changes occur, and a double indicating the size of the offset in hours (probably always 1.00).
Month names should be the English three-letter abbreviation, uncapitalized. Day names are either an integer indicating the calendar date (i.e., "15" is the fifteenth of the month), or a number paired with a three-letter abbreviation for a weekday. This indicates the Nth weekday of the month (i.e., "2sun" is the second Sunday of the Month). Finally, the weekday string on its own indicates the last weekday of the month (i.e., "mon" is the last Monday of the month).
The isDSTActive(KStarsDateTime) function returns true if DST is active for the DateTime given as an argument.
The nextDSTChange(KStarsDateTime) function returns the KStarsDateTime of the moment at which the next DST change will occur for the current location.
- Jason Harris
Definition at line 47 of file timezonerule.h.
Recalculate next dst change and if DST is active by a given local time with timezone offset and time direction.
|ltime||the time to be tested |
|time_runs_forward||time direction |
|TZoffset||offset of timezone in some fictional unit |
|automaticDSTchange||is automatic DST change?|
- Check dox for TZoffset
There are some problems using local time for getting next daylight saving change time.
- The local time is the start time of DST change. So the local time doesn't exists and must corrected.
- The local time is the revert time. So the local time exists twice.
- Neither start time nor revert time. There is no problem.
Problem #1 is more complicated and we have to change the local time by reference. Problem #2 we just have to reset status of DST.
automaticDSTchange should only set to true if DST status changed due to running automatically over a DST change time. If local time will changed manually the automaticDSTchange should always set to false, to hold current DST status if possible (just on start and revert time possible).
Definition at line 432 of file timezonerule.cpp.