| ︙ | | |
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
+
+
|
namespace export milliseconds
namespace export scan
namespace export seconds
namespace export add
# Import the message catalog commands that we use.
namespace import ::msgcat::mcload
namespace import ::msgcat::mclocale
namespace import ::msgcat::mc
namespace import ::msgcat::mcpackagelocale
}
#----------------------------------------------------------------------
#
|
| ︙ | | |
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
|
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
|
-
|
try {
# Map away the locale-dependent composite format groups
set scanner [ParseClockScanFormat $format $locale]
return [$scanner $string $base $timezone]
} trap CLOCK {result opts} {
# Conceal location of generation of expected errors
dict unset opts -errorinfo
return -options $opts $result
}
}
#----------------------------------------------------------------------
#
|
| ︙ | | |
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
|
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
|
-
-
-
+
-
-
-
+
|
#
# EnterLocale --
#
# Switch [mclocale] to a given locale if necessary
#
# Parameters:
# locale -- Desired locale
# oldLocaleVar -- Name of a variable in caller's scope that
# tracks the previous locale name.
#
# Results:
# Returns the locale that was previously current.
#
# Side effects:
# Does [mclocale]. If necessary, uses [mcload] to load the designated
# Does [mclocale]. If necessary, loades the designated locale's files.
# locale's files, and tracks that it has done so in the 'McLoaded'
# variable.
#
#----------------------------------------------------------------------
proc ::tcl::clock::EnterLocale { locale } {
if { $locale eq {system} } {
if { $::tcl_platform(platform) ne {windows} } {
# On a non-windows platform, the 'system' locale is the same as
# the 'current' locale
set locale current
} else {
# On a windows platform, the 'system' locale is adapted from the
# 'current' locale by applying the date and time formats from the
# Control Panel. First, load the 'current' locale if it's not yet
# loaded
mcpackagelocale [mclocale]
mcpackagelocale set [mclocale]
# Make a new locale string for the system locale, and get the
# Control Panel information
set locale [mclocale]_windows
if { $locale ni [::msgcat::mcpackagelocale loaded] } {
LoadWindowsDateTimeFormats $locale
|
| ︙ | | |
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
|
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
|
-
+
|
lappend list %EX [string map $list [mc LOCALE_TIME_FORMAT]]
lappend list %x [string map $list [mc DATE_FORMAT]]
lappend list %Ex [string map $list [mc LOCALE_DATE_FORMAT]]
lappend list %c [string map $list [mc DATE_TIME_FORMAT]]
lappend list %Ec [string map $list [mc LOCALE_DATE_TIME_FORMAT]]
set format [string map $list $format]
mcset $locale $key $format
::msgcat::mcset $locale $key $format
return $format
}
#----------------------------------------------------------------------
#
# FormatNumericTimeZone --
#
|
| ︙ | | |
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
|
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
|
-
|
#
# Side effects:
# None.
#
#----------------------------------------------------------------------
proc ::tcl::clock::AddMonths { months clockval timezone changeover } {
variable DaysInRomanMonthInCommonYear
variable DaysInRomanMonthInLeapYear
variable TZData
# Convert the time to year, month, day, and fraction of day.
set date [GetDateFields $clockval $TZData($timezone) $changeover]
|
| ︙ | | |
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
|
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
|
-
-
-
|
}
foreach p [info procs [namespace current]::formatproc'*] {
rename $p {}
}
catch {unset FormatProc}
set LocaleNumeralCache {}
# this removes many required keys and makes the module unusable
mcpackagelocale set ""
mcpackagelocale clear
catch {unset CachedSystemTimeZone}
set TimeZoneBad {}
InitTZData
}
|