財(cái)產(chǎn)保險(xiǎn)基本險(xiǎn)保險(xiǎn)單正本_第1頁
財(cái)產(chǎn)保險(xiǎn)基本險(xiǎn)保險(xiǎn)單正本_第2頁
財(cái)產(chǎn)保險(xiǎn)基本險(xiǎn)保險(xiǎn)單正本_第3頁
財(cái)產(chǎn)保險(xiǎn)基本險(xiǎn)保險(xiǎn)單正本_第4頁
財(cái)產(chǎn)保險(xiǎn)基本險(xiǎn)保險(xiǎn)單正本_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

-----------

#

#AssignBaseWeek--

#

# DeterminesthebaseyearandweekintheISO8601fiscalcalendar.

#

#Parameters:

# date-Dictionarycontainingthefieldsofthedatethat

# istobeaugmentedwiththebaseyearandweek.

# baseTime-BasetimeexpressedinsecondsfromthePosixepoch.

# changeover-JulianDayonwhichtheGregoriancalendarwasadopted

# inthetargetlocale.

#

#Results:

# Returnsthegivendatewith"iso8601Year"settothe

# baseyearand"iso8601Week"totheweeknumber.

#

#Sideeffects:

# None.

#

#----------------------------------------------------------------------

proc::tcl::clock::AssignBaseWeek{datebaseTimetimeZonechangeover}{

variableTZData

#FindtheJulianDayNumbercorrespondingtothebasetime

setdate2[GetDateFields$baseTime$TZData($timeZone)$changeover]

#CalculatetheISO8601dateandtransfertheyear

dictsetdateeraCE

dictsetdateiso8601Year[dictget$date2iso8601Year]

dictsetdateiso8601Week[dictget$date2iso8601Week]

return$date

}

#----------------------------------------------------------------------

#

#AssignBaseJulianDay--

#

# Determinesthebasedayforatime-of-dayconversion.

#

#Parameters:

# date-Dictionarythatistogetthebaseday

# baseTime-BasetimeexpressedinsecondsfromthePosixepoch

# changeover-JuliandayonwhichtheGregoriancalendarwas

# adpotedinthetargetlocale.

#

#Results:

# Returnsthegivendictionaryaugmentedwitha'julianDay'field

# thatcontainsthebaseday.

#

#Sideeffects:

# None.

#

#----------------------------------------------------------------------

proc::tcl::clock::AssignBaseJulianDay{datebaseTimetimeZonechangeover}{

variableTZData

#FindtheJulianDayNumbercorrespondingtothebasetime

setdate2[GetDateFields$baseTime$TZData($timeZone)$changeover]

dictsetdatejulianDay[dictget$date2julianDay]

return$date

}

#----------------------------------------------------------------------

#

#InterpretHMSP--

#

# Interpretsatimeintheform"hh:mm:ssam".

#

#Parameters:

# date--Dictionarycontaining"hourAMPM","minute","second"

# and"amPmIndicator"fields.

#

#Results:

# Returnsthenumberofsecondsfromlocalmidnight.

#

#Sideeffects:

# None.

#

#----------------------------------------------------------------------

proc::tcl::clock::InterpretHMSP{date}{

sethr[dictget$datehourAMPM]

if{$hr==12}{

sethr0

}

if{[dictget$dateamPmIndicator]}{

incrhr12

}

dictsetdatehour$hr

return[InterpretHMS$date[setdate{}]]

}

#----------------------------------------------------------------------

#

#InterpretHMS--

#

# Interpretsa24-hourtime"hh:mm:ss"

#

#Parameters:

# date--Dictionarycontainingthe"hour","minute"and"second"

# fields.

#

#Results:

# Returnsthegivendictionaryaugmentedwitha"secondOfDay"

# fieldcontainingthenumberofsecondsfromlocalmidnight.

#

#Sideeffects:

# None.

#

#----------------------------------------------------------------------

proc::tcl::clock::InterpretHMS{date}{

return[expr{

([dictget$datehour]*60

+[dictget$dateminute])*60

+[dictget$datesecond]

}]

}

#----------------------------------------------------------------------

#

#GetSystemTimeZone--

#

# Determinesthesystemtimezone,whichisthedefaultforthe

# 'clock'commandifnootherzoneissupplied.

#

#Parameters:

# None.

#

#Results:

# Returnsthesystemtimezone.

#

#Sideeffects:

# Storesthesustemtimezoneinthe'CachedSystemTimeZone'

# variable,sincedeterminingitmaybeanexpensiveprocess.

#

#----------------------------------------------------------------------

proc::tcl::clock::GetSystemTimeZone{}{

variableCachedSystemTimeZone

variableTimeZoneBad

if{[setresult[getenvTCL_TZ]]ne{}}{

settimezone$result

}elseif{[setresult[getenvTZ]]ne{}}{

settimezone$result

}

if{![infoexiststimezone]}{

#Cachethetimezoneonlyifitwasdetectedbyoneofthe

#expensivemethods.

if{[infoexistsCachedSystemTimeZone]}{

settimezone$CachedSystemTimeZone

}elseif{$::tcl_platform(platform)eq{windows}}{

settimezone[GuessWindowsTimeZone]

}elseif{[fileexists/etc/localtime]

&&![catch{ReadZoneinfoFile\

Tcl/Localtime/etc/localtime}]}{

settimezone:Tcl/Localtime

}else{

settimezone:localtime

}

setCachedSystemTimeZone$timezone

}

if{![dictexists$TimeZoneBad$timezone]}{

dictsetTimeZoneBad$timezone[catch{SetupTimeZone$timezone}]

}

if{[dictget$TimeZoneBad$timezone]}{

return:localtime

}else{

return$timezone

}

}

#----------------------------------------------------------------------

#

#ConvertLegacyTimeZone--

#

# Givenanalphanumerictimezoneidentifierandthesystemtimezone,

# convertthealphanumericidentifiertoanunambiguoustimezone.

#

#Parameters:

# tzname-Nameofthetimezonetoconvert

#

#Results:

# Returnsatimezonenamecorrespondingtotzname,butinan

# unambiguousform,generally+hhmm.

#

#ThisprocedureisimplementedprimarilytoallowtheparsingofRFC822

#date/timestrings.Processingatimezonenameoninputisnotrecommended

#practice,becausethereisconsiderableroomforambiguity;forinstance,is

#BSTBrazilianStandardTime,orBritishSummerTime?

#

#----------------------------------------------------------------------

proc::tcl::clock::ConvertLegacyTimeZone{tzname}{

variableLegacyTimeZone

settzname[stringtolower$tzname]

if{![dictexists$LegacyTimeZone$tzname]}{

return-codeerror-errorcode[listCLOCKbadTZName$tzname]\

"timezone\"$tzname\"notfound"

}

return[dictget$LegacyTimeZone$tzname]

}

#----------------------------------------------------------------------

#

#SetupTimeZone--

#

# Giventhenameorspecificationofatimezone,setsupitsin-memory

# data.

#

#Parameters:

# tzname-Nameofatimezone

#

#Results:

# Unlessthetimezoneis':localtime',setstheTZDataarraytocontain

# thelookuptableforlocal<->UTCconversion.Returnsanerrorifthe

# timezonecannotbeparsed.

#

#----------------------------------------------------------------------

proc::tcl::clock::SetupTimeZone{timezone}{

variableTZData

if{![infoexistsTZData($timezone)]}{

variableMINWIDE

if{$timezoneeq{:localtime}}{

#Nothingtodo,we'llconvertusingthelocaltimefunction

}elseif{

[regexp{^([-+])(\d\d)(?::?(\d\d)(?::?(\d\d))?)?}$timezone\

->shhmmss]

}then{

#Makeafixedoffset

::scan$hh%dhh

if{$mmeq{}}{

setmm0

}else{

::scan$mm%dmm

}

if{$sseq{}}{

setss0

}else{

::scan$ss%dss

}

setoffset[expr{($hh*60+$mm)*60+$ss}]

if{$seq{-}}{

setoffset[expr{-$offset}]

}

setTZData($timezone)[list[list$MINWIDE$offset-1$timezone]]

}elseif{[stringindex$timezone0]eq{:}}{

#Convertusingatimezonefile

if{

[catch{

LoadTimeZoneFile[stringrange$timezone1end]

}]&&[catch{

LoadZoneinfoFile[stringrange$timezone1end]

}]

}then{

return-codeerror\

-errorcode[listCLOCKbadTimeZone$timezone]\

"timezone\"$timezone\"notfound"

}

}elseif{![catch{ParsePosixTimeZone$timezone}tzfields]}{

#ThislookslikeaPOSIXtimezone-trytoprocessit

if{[catch{ProcessPosixTimeZone$tzfields}dataopts]}{

if{[lindex[dictget$opts-errorcode]0]eq{CLOCK}}{

dictunsetopts-errorinfo

}

return-options$opts$data

}else{

setTZData($timezone)$data

}

}else{

#Wecouldn'tparsethisasaPOSIXtimezone.Tryagainwitha

#timezonefile-thistimewithoutacolon

if{[catch{LoadTimeZoneFile$timezone}]

&&[catch{LoadZoneinfoFile$timezone}-opts]}{

dictunsetopts-errorinfo

return-options$opts"timezone$timezonenotfound"

}

setTZData($timezone)$TZData(:$timezone)

}

}

return

}

#----------------------------------------------------------------------

#

#GuessWindowsTimeZone--

#

# Determinesthesystemtimezoneonwindows.

#

#Parameters:

# None.

#

#Results:

# Returnsatimezonespecifierthatcorrespondstothesystemtimezone

# informationfoundintheRegistry.

#

#Bugs:

# FixeddatesforDSTchangeareunimplementedatpresent,becauseno

# timezoneinformationsuppliedwithWindowsactuallyusesthem!

#

#OnaWindowssystemwhereneither$env(TCL_TZ)nor$env(TZ)isspecified,

#GuessWindowsTimeZonelooksintheRegistryforthesystemtimezone

#information.ItthenattemptstofindanentryinWinZoneInfoforatime

#zonethatusesthesamerules.Ifitfindsone,itreturnsit;otherwise,

#itconstructsaPosix-styletimezonestringandreturnsthat.

#

#----------------------------------------------------------------------

proc::tcl::clock::GuessWindowsTimeZone{}{

variableWinZoneInfo

variableNoRegistry

variableTimeZoneBad

if{[infoexistsNoRegistry]}{

return:localtime

}

#Dredgetimezoneinformationoutoftheregistry

if{[catch{

setrpathHKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\TimeZoneInformation

setdata[list\

[expr{-60

*[registryget$rpathBias]}]\

[expr{-60

*[registryget$rpathStandardBias]}]\

[expr{-60\

*[registryget$rpathDaylightBias]}]]

setstdtzi[registryget$rpathStandardStart]

foreachind{02144681012}{

binaryscan$stdtzi@${ind}sval

lappenddata$val

}

setdaytzi[registryget$rpathDaylightStart]

foreachind{02144681012}{

binaryscan$daytzi@${ind}sval

lappenddata$val

}

}]}{

#MissingvaluesintheRegistry-bailout

return:localtime

}

#MakeupaPosixtimezonespecifierifwecan'tfindone.Checkhere

#thatthetzdatafileexists,incasewe'rerunninginanenvironment

#(e.g.starpack)wheretzdataisincomplete.(Bug1237907)

if{[dictexists$WinZoneInfo$data]}{

settzname[dictget$WinZoneInfo$data]

if{![dictexists$TimeZoneBad$tzname]}{

dictsetTimeZoneBad$tzname[catch{SetupTimeZone$tzname}]

}

}else{

settzname{}

}

if{$tznameeq{}||[dictget$TimeZoneBad$tzname]}{

lassign$data\

biasstdBiasdstBias\

stdYearstdMonthstdDayOfWeekstdDayOfMonth\

stdHourstdMinutestdSecondstdMillisec\

dstYeardstMonthdstDayOfWeekdstDayOfMonth\

dstHourdstMinutedstSeconddstMillisec

setstdDelta[expr{$bias+$stdBias}]

setdstDelta[expr{$bias+$dstBias}]

if{$stdDelta<=0}{

setstdSignum+

setstdDelta[expr{-$stdDelta}]

setdispStdSignum-

}else{

setstdSignum-

setdispStdSignum+

}

sethh[::format%02d[expr{$stdDelta/3600}]]

setmm[::format%02d[expr{($stdDelta/60)%60}]]

setss[::format%02d[expr{$stdDelta%60}]]

settzname{}

appendtzname<$dispStdSignum$hh$mm>$stdSignum$hh:$mm:$ss

if{$stdMonth>=0}{

if{$dstDelta<=0}{

setdstSignum+

setdstDelta[expr{-$dstDelta}]

setdispDstSignum-

}else{

setdstSignum-

setdispDstSignum+

}

sethh[::format%02d[expr{$dstDelta/3600}]]

setmm[::format%02d[expr{($dstDelta/60)%60}]]

setss[::format%02d[expr{$dstDelta%60}]]

appendtzname<$dispDstSignum$hh$mm>$dstSignum$hh:$mm:$ss

if{$dstYear==0}{

appendtzname,M$dstMonth.$dstDayOfMonth.$dstDayOfWeek

}else{

#IhavenotbeenabletofindanylocaleonwhichWindows

#convertstimezoneonafixeddayoftheyear,hencedon't

#knowhowtointerpretthefields.Ifsomeonecaninformme,

#I'dbegladtocodeitup.Forrightnow,webailoutin

#suchacase.

return:localtime

}

appendtzname/[::format%02d$dstHour]\

:[::format%02d$dstMinute]\

:[::format%02d$dstSecond]

if{$stdYear==0}{

appendtzname,M$stdMonth.$stdDayOfMonth.$stdDayOfWeek

}else{

#IhavenotbeenabletofindanylocaleonwhichWindows

#convertstimezoneonafixeddayoftheyear,hencedon't

#knowhowtointerpretthefields.Ifsomeonecaninformme,

#I'dbegladtocodeitup.Forrightnow,webailoutin

#suchacase.

return:localtime

}

appendtzname/[::format%02d$stdHour]\

:[::format%02d$stdMinute]\

:[::format%02d$stdSecond]

}

dictsetWinZoneInfo$data$tzname

}

return[dictget$WinZoneInfo$data]

}

#----------------------------------------------------------------------

#

#LoadTimeZoneFile--

#

# Loadthedatafilethatspecifiestheconversionbetweena

# giventimezoneandGreenwich.

#

#Parameters:

# fileName--Nameofthefiletoload

#

#Results:

# None.

#

#Sideeffects:

# TZData(:fileName)containsthetimezonedata

#

#----------------------------------------------------------------------

proc::tcl::clock::LoadTimeZoneFile{fileName}{

variableDataDir

variableTZData

if{[infoexistsTZData($fileName)]}{

return

}

#Sinceanunsafeinterpusesthe[clock]commandinthemaster,thiscode

#issecuritysensitive.Makesurethatthepathnamecannotescapethe

#givendirectory.

if{![regexp{^[[.-.][:alpha:]_]+(?:/[[.-.][:alpha:]_]+)*$}$fileName]}{

return-codeerror\

-errorcode[listCLOCKbadTimeZone$:fileName]\

"timezone\":$fileName\"notvalid"

}

try{

source-encodingutf-8[filejoin$DataDir$fileName]

}onerror{}{

return-codeerror\

-errorcode[listCLOCKbadTimeZone:$fileName]\

"timezone\":$fileName\"notfound"

}

return

}

#----------------------------------------------------------------------

#

#LoadZoneinfoFile--

#

# LoadsabinarytimezoneinformationfileinOlsonformat.

#

#Parameters:

# fileName-Relativepathnameofthefiletoload.

#

#Results:

# Returnsanemptyresultnormally;returnsanerrorifnoOlsonfile

# wasfoundorthefilewasmalf

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論