Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/olson.php File Reference

Go to the source code of this file.

Namespaces

namespace  moodlecore

Functions

 olson_to_timezones ($filename)
 olson_simple_rule_parser ($filename)
 olson_simple_zone_parser ($filename)
 olson_parse_offset ($offset)
 olson_parse_on ($on)
 olson_parse_at ($at, $set= 'set', $gmtoffset)

Function Documentation

olson_parse_at ( at,
set = 'set',
gmtoffset 
)

olson_parse_at($at, $set, $gmtoffset)

see `man zic`. This function translates

2 time in hours 2:00 time in hours and minutes 15:00 24-hour format time (for times after noon) 1:28:14 time in hours, minutes, and seconds

Any of these forms may be followed by the letter w if the given time is local "wall clock" time, s if the given time is local "standard" time, or u (or g or z) if the given time is univer- sal time; in the absence of an indicator, wall clock time is assumed.

Returns:
string a moodle friendly $at, in GMT, which is what Moodle wants

Definition at line 682 of file olson.php.

Here is the caller graph for this function:

olson_parse_offset ( offset)

olson_parse_offset($offset)

parses time offsets from the GMTOFF and SAVE fields into +/-MINUTES

Returns:
int

Definition at line 558 of file olson.php.

Here is the caller graph for this function:

olson_parse_on ( on)

olson_parse_on_($on)

see `man zic`. This function translates the following formats 5 the fifth of the month lastSun the last Sunday in the month lastMon the last Monday in the month Sun>=8 first Sunday on or after the eighth Sun<=25 last Sunday on or before the 25th

to a moodle friendly format. Returns an array with:

startday: the day of the month that we start counting from. if negative, it means we start from that day and count backwards. since -1 would be meaningless, it means "end of month and backwards". weekday: the day of the week that we must find. we will scan days from the startday until we find the first such weekday. 0...6 = Sun...Sat. -1 means that any day of the week will do, effectively ending the search on startday. skipweeks:after finding our end day as outlined above, skip this many weeks. this enables us to find "the second sunday >= 10". usually will be 0.

Definition at line 606 of file olson.php.

Here is the caller graph for this function:

olson_simple_rule_parser ( filename)

olson_simple_rule_parser($filename)

Parses the olson files for DST rules. It's a simple implementation that simplifies some fields

Returns:
array a multidimensional array, or false on error

Definition at line 216 of file olson.php.

Here is the call graph for this function:

Here is the caller graph for this function:

olson_simple_zone_parser ( filename)

olson_simple_zone_parser($filename)

Parses the olson files for zone info

Returns:
array a multidimensional array, or false on error

Definition at line 436 of file olson.php.

Here is the call graph for this function:

Here is the caller graph for this function:

olson_to_timezones ( filename)

olson_to_timezones ($filename)

Parses the olson files for Zones and DST rules. It updates the Moodle database with the Zones/DST rules

Parameters:
string$filename
Returns:
bool true/false

To translate the combined Zone & Rule changes in the Olson files to the Moodle single ruleset format, we need to trasverse every year and see if either the Zone or the relevant Rule has a change. It's yuck but it yields a rationalized set of data, which is arguably simpler.

Also note that I am starting at the epoch (1970) because I don't think we'll see many events scheduled before that, anyway.

Loop over years, only adding a rule when zone or rule have changed. All loops preserver the last seen vars until there's an explicit decision to delete them

1971 onwards

We create a "zonerule" entry if either zone or rule change...

force $y to string to avoid PHP thinking of a positional array

Since Moodle 1.7, rule is tzrule in DB (reserved words problem), so change it here after everything is calculated to be properly loaded to the timezone table. Pre 1.7 users won't have the old rule if updating this from moodle.org but it seems that such field isn't used at all by the rest of Moodle (at least I haven't found any use when looking for it).

Definition at line 34 of file olson.php.

Here is the call graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations