diff options
Diffstat (limited to 'tools/tclZIC.tcl')
| -rwxr-xr-x | tools/tclZIC.tcl | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/tclZIC.tcl b/tools/tclZIC.tcl index 5fd861f..85c9ba9 100755 --- a/tools/tclZIC.tcl +++ b/tools/tclZIC.tcl @@ -28,13 +28,8 @@ # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# -# RCS: @(#) $Id: tclZIC.tcl,v 1.8 2005/12/05 20:40:42 kennykb Exp $ -# #---------------------------------------------------------------------- -package require Tcl 8.5 - # Define the names of the Olson files that we need to load. # We avoid the solar time files and the leap seconds. @@ -168,7 +163,7 @@ proc loadZIC {fileName} { # Detect continuations of a zone and flag the list appropriately lappend words "" } - lappend words {expand}[regexp -all -inline {\S+} $line] + lappend words {*}[regexp -all -inline {\S+} $line] # Switch on the directive @@ -361,7 +356,7 @@ proc parseON {on} { # third possibility - lastWeekday - field 5 last([[:alpha:]]+) )$ - } $on -> dom1 wday2 dir2 num2 wday3]} then { + } $on -> dom1 wday2 dir2 num2 wday3]} { error "can't parse ON field \"$on\"" } if {$dom1 ne ""} { @@ -397,6 +392,9 @@ proc parseON {on} { #---------------------------------------------------------------------- proc onDayOfMonth {day year month} { + scan $day %d day + scan $year %d year + scan $month %d month set date [::tcl::clock::GetJulianDayFromEraYearMonthDay \ [dict create era CE year $year month $month dayOfMonth $day] \ 2361222] @@ -509,7 +507,7 @@ proc parseTOD {tod} { (?: ([wsugz]) # field 4 - type indicator )? - } $tod -> hour minute second ind]} then { + } $tod -> hour minute second ind]} { puts stderr "$fileName:$lno:can't parse time field \"$tod\"" incr errorCount } @@ -558,7 +556,7 @@ proc parseOffsetTime {offset} { :([[:digit:]]{2}) # field 4 - second )? )? - } $offset -> signum hour minute second]} then { + } $offset -> signum hour minute second]} { puts stderr "$fileName:$lno:can't parse offset time \"$offset\"" incr errorCount } @@ -914,7 +912,7 @@ proc applyRules {ruleSet year startSecs stdGMTOffset DSTOffset nextGMTOffset set untilBaseSecs [expr { wide(86400) * wide($untilJCD) - 210866803200 }] set untilSecs [convertTimeOfDay $untilBaseSecs $stdGMTOffset \ - $DSTOffset {expand}$untilTimeOfDay] + $DSTOffset {*}$untilTimeOfDay] } set origStartSecs $startSecs @@ -940,7 +938,7 @@ proc applyRules {ruleSet year startSecs stdGMTOffset DSTOffset nextGMTOffset if { $earliestSecs > $startSecs && ($until eq "" || $earliestSecs < $untilSecs) - } then { + } { # Test if the initial transition has been done. # If not, do it now. @@ -979,7 +977,7 @@ proc applyRules {ruleSet year startSecs stdGMTOffset DSTOffset nextGMTOffset if {$until ne ""} { set untilSecs [convertTimeOfDay $untilBaseSecs \ - $stdGMTOffset $DSTOffset {expand}$untilTimeOfDay] + $stdGMTOffset $DSTOffset {*}$untilTimeOfDay] } } @@ -989,7 +987,7 @@ proc applyRules {ruleSet year startSecs stdGMTOffset DSTOffset nextGMTOffset set date [::tcl::clock::GetJulianDayFromEraYearMonthDay \ [dict create era CE year $year month 1 dayOfMonth 1] 2361222] set startSecs [expr { - [dict get $date julianDay] * wide(86400) - 210866803200 + [dict get $date julianDay] * wide(86400) - 210866803200 - $stdGMTOffset - $DSTOffset }] @@ -1081,7 +1079,7 @@ proc findEarliestRule {remainingRules year stdGMTOffset DSTOffset} { set dayIn [eval $daySpecOn] set secs [expr {wide(86400) * wide($dayIn) - 210866803200}] set secs [convertTimeOfDay $secs \ - $stdGMTOffset $DSTOffset {expand}$timeAt] + $stdGMTOffset $DSTOffset {*}$timeAt] if {$secs < $earliest} { set earliest $secs set earliestIdx $i @@ -1207,7 +1205,7 @@ proc processTimeZone {zoneName zoneData} { set startDay [eval $dayRule] set secs [expr {wide(86400) * wide($startDay) -210866803200}] set secs [convertTimeOfDay $secs \ - $stdGMTOffset $DSTOffset {expand}$timeOfDay] + $stdGMTOffset $DSTOffset {*}$timeOfDay] } lappend dstRule \ $year $secs $stdGMTOffset $DSTOffset $nextGMTOffset \ @@ -1265,6 +1263,7 @@ proc writeZones {outDir} { # Write the data to the information file set f [open $fileName w] + fconfigure $f -translation lf puts $f "\# created by $::argv0 - do not edit" puts $f "" puts $f [list set TZData(:$zoneName) $data] @@ -1317,6 +1316,7 @@ proc writeLinks {outDir} { # Write the file set f [open $fileName w] + fconfigure $f -translation lf puts $f "\# created by $::argv0 - do not edit" puts $f $ifCmd puts $f $setCmd |
