clipboardICAS and daylight saving time
clipboardICAS and daylight saving time
- Subject: clipboardICAS and daylight saving time
- From: "AAT at www.aatideas.org" <email@hidden>
- Date: Tue, 5 Apr 2005 17:16:47 -0700
Title: clipboardICAS and daylight saving
time
The clipboardICAS applescript was reformatted to accommodate
daylight savings time.
There is new datetime code too.
Ron
==== begin code _clipboardICAS_ version 0.01 ====
--
clipboardICAS.applescript
-- clipboardICAS
(*
_clipboardICAS_ version 0.01
applescript code is copyright © 2005 UCA and prior, Alliance for the
Advancement of Technology
version 0.01 specifies code objects for formatted display of seasonal
time codes,
and integrates UC engine for zoneDeka times
version 0.00 (release was not numbered) specified some preliminary
objects
for time, date, and datetime formatsets; and is now deprecated.
The bug "2004December31 is not a valid date" may be resolved
by opening:
--> System Preferences --> International
--> formats
and then configuring date format order as [Year Month Day Weekday and
yyyy-mm-dd-weekday].
The Mac OS international format preferences can also configure
--Measurement Units-- to "Metric".
code developed by Ron Stone for AAT with reference to the
_Current Date & Time_ sample script by Apple Computer, Inc.;
and the Integrated Chronological Applications System (ICAS)
licensed by Alliance for the Advancement of Technology (AAT).
Acknowledgements as well to the Applescript users list
and the Perceptive Automation Forum for Applescript.
Use of this script is only permitted subject to conformance with
'ICAS in use' terms of use referenced on the
http://www.aatideas.org/itinica/license/index.html ICAS licenses
page.
Extensibility of this code to uniform scales of calendar and clock is
subject to limitations.
Changes or modifications to this code are permitted subject to
conformance with
'ICAS in use' and ICAS licensing, and on the condition that the
resulting code
represent the use of 'ICAS in use' for any subsequent developer,
and not the developer of this code.
The Uniform Calendar (UC), New Calendar (NC), and Inter-Dial Clock
(IDC)
systems are part of the Integrated Chronological Applications System
(ICAS).
AAT provides ICAS standards documents subject to terms of use
described
in document AAT ICAS Agave-9010. Please refer to other key
AAT ICAS standards documents accessible via the AAT ICAS web site
at
http://www.aatideas.org/icas for important information about ICAS.
AAT has made efforts to ensure the quality of ICAS resources;
however is not responsible for errors. aatideas implementations of
ICAS including AppleScript and Java are not designed for fault
tolerance
nor are intended for use in high-risk situations
calling for fault tolerant software/hardware systems.
*)
-- time from computer clock
set zodiacYear to (year of (current date)) -- is number
set zodiacMonth to (month of (current date))
set zodiacDay to (day of (current date))
set zodiacWeekday to (weekday of (current date))
set zodiacTime to (time of (current date))
--formats the current SMH clock time
set smhHours to (zodiacTime div hours)
set properHours to characters 2 thru 3 of ((smhHours + 100) as
string)
set smhMinutes to ((zodiacTime - (smhHours * 3600)) div minutes)
set properMinutes to characters 2 thru 3 of ((smhMinutes + 100) as
string)
set smhSeconds to ((zodiacTime) - (zodiacTime div 60) * 60)
set properSeconds to characters 2 thru 3 of ((smhSeconds + 100) as
string)
--calculates the UT time for both SMH and IDC
set offsetUT to (time to GMT)
set zodiacUT to ((zodiacTime) - offsetUT)
if (((smhHours) - (offsetUT div hours)) > 23) then
--(if UT clocks midnight
first)
set utHours to (((smhHours) - (offsetUT div hours)) -
24)
else if (((smhHours) - (offsetUT div hours)) < 0) then
--(if my time zone clocks midnight before UT)
set utHours to (((smhHours) - (offsetUT
div hours)) + 24)
else
set utHours to (((smhHours) - (offsetUT
div hours)))
--(if my time zone and UT are in
same calendar day)
end if
set utMinutes to smhMinutes -- code not necessarily extensible for
time zones other than the hour increments, the ((currentUT - (utHours
* 3600)) div minutes) did not debug, other zones may need to apply an
extensible debug or a zone minute offset
set utSeconds to ((zodiacUT)
- (zodiacUT div 60) * 60)
set idcUT to ((86400 + zodiacUT) / 86400) -- is value + 1 for purposes
of determining datetime values for local and previous days
--formats the SMH-UT clock times
set proputHours to characters 2 thru 3 of ((utHours + 100) as
string)
set proputMinutes to characters 2 thru 3 of ((utMinutes + 100) as
string)
set proputSeconds to characters 2 thru 3 of ((utSeconds + 100) as
string)
--calculates the local zoneDeka times
set idcCurrent to (zodiacTime / 86400)
set dekaSamoa to ((idcUT) - 0.45)
set dekaHonolulu to ((idcUT) - 0.4)
set dekaJuneau to ((idcUT) - 0.35)
set dekaSanJose to ((idcUT) - 0.3)
set dekaMpls to ((idcUT) - 0.25)
set dekaChicago to ((idcUT) - 0.2)
set dekaDetroit to ((idcUT) - 0.2)
set dekaNewYork to ((idcUT) - 0.2)
set dekaRio to ((idcUT) - 0.1)
set dekaReykjavik to ((idcUT) - 0.05)
set dekaLondon to (idcUT)
set dekaParis to ((idcUT) + 0.05)
set dekaKiev to ((idcUT) + 0.1)
set dekaMoscow to ((idcUT) + 0.15)
set dekaKarachi to ((idcUT) + 0.2)
set dekaBombay to ((idcUT) + 0.25)
set dekaSingapore to ((idcUT) + 0.3)
set dekaHongKong to ((idcUT) + 0.35)
set dekaTokyo to ((idcUT) + 0.4)
set dekaSydney to ((idcUT) + 0.45)
set dekaNewZealand to ((idcUT) + 0.5)
-- please see AAT ICAS Agave-3134 AAT ICAS zoneDeka zone set for
additional information about deka system time zones
-- formats the local timezone objects (as designated here, for
American Pacific locales)
set dekaLocal to (dekaSanJose) -- defines formatset time for a local
timezone defined above
set tcodeC to ("SanJose") -- defines format display of city
defined in dekaLocal above
set tcodeD to ("PDT") -- defines daylight time display for
Pacific Daylight Time
set tcodeS to ("PST") -- defines standard time display for
Pacific Standard Time
set tcodeZ to tcodeD -- sets timezone code for display of specific
timezone implementation defined above
--formats the local IDC times
set properUT to characters 3 thru 5 of ((idcUT) as string)
set properDekaLocal to characters 3 thru 5 of ((dekaLocal) as
string)
set properCurrent to characters 3 thru 5 of ((idcCurrent) as
string)
--calculates the Uniform Calendar and New Calendar dates from computer
clock
set propnumerMonth to characters 2 thru 3 of ((zodiacMonth + 100) as
string) -- for use in zodiacDate with numerical representations of
month
set properDay to characters 2 thru 3 of ((zodiacDay + 100) as
string)
set priorYear to ((year of (current date)) - 1) --is number
set priorDecember to "December" as string
set priorLast to "31" as string
set priorEnd to (priorYear & priorDecember & priorLast as
string) --is string in format YYYY Month Day
set zodiacDate to (zodiacYear & " " & zodiacMonth &
" " & properDay as string) --is string
set currentSMH to (properHours & ":" & properMinutes
& ":" & properSeconds)
set currentUTSMH to (proputHours & ":" &
proputMinutes & ":" & proputSeconds)
set numEnd to date priorEnd as date --sets string to numerical
date
set numCurrent to date zodiacDate as date --sets string to numerical
date
set numDayofYear to (((numCurrent) - (numEnd)) div 86400)
set properDayofYear to characters 2 thru 4 of ((numDayofYear + 1000)
as string) --is string
-- determines Uniform Calendar year type
set rule4n100 to (false)
set rule400 to (false)
set ruleZero to (false)
if (((zodiacYear div 4) = (zodiacYear / 4)) and ¬
((zodiacYear div 100) (zodiacYear /
100))) then
set rule4n100 to
(true)
end if
if ((zodiacYear div 400) = (zodiacYear / 400)) then
set rule400
to (true)
end if
if zodiacYear = 0 then
set ruleZero to
(true)
end if
if rule4n100 or rule400 or ruleZero is true then
set yearType to "leap"
else
set yearType to
"common"
end if
if ((zodiacYear div 2) = (zodiacYear / 2)) then
set biAnnum to "even"
else
set biAnnum to
"odd"
end if
if ((((numDayofYear - 1) div 30) + 1) < 12) then
set umOrdinal to
((((numDayofYear - 1) div 30) + 1))
else
set
umOrdinal to 12
end if
set biEven to "ABCDEFGHJKLM"
set biOdd to "NPQRSTUVWXYZ"
if biAnnum is "even" then
set uniformMonth
to character umOrdinal of biEven
else
set uniformMonth to character umOrdinal of
biOdd
end if
set numDayofUmonth to ((numDayofYear - (umOrdinal * 30) + 30))
set properDayofUmonth to characters 2 thru 3 of ((numDayofUmonth +
100) as string)
set yearNC to zodiacYear + 10000
-- determines the UC date for zoneDeka
if (dekaLocal is less than 1) then
set dekaDate to ((current date) - 86400)
-- (if
zoneDeka is in previous day)
else if (dekaLocal is greater than 2) then
set dekaDate to ((current date) +
86400)
-- (if
zoneDeka is in next day)
else
set dekaDate to (current
date)
end if
set dekaYear to (year of (dekaDate)) -- is number
set dekaMonth to (month of (dekaDate))
set dekaDay to (day of (dekaDate))
set properDekaDay to characters 2 thru 3 of ((dekaDay + 100) as
string)
set dekaTrad to (dekaYear & " " & dekaMonth & "
" & properDekaDay as string) --is string
set priorYearDeka to (dekaYear - 1) --is number
set priorEndDeka to (priorYearDeka & priorDecember & priorLast
as string) --is string in format YYYY Month Day
set numEndDeka to date priorEndDeka as date --sets string to numerical
date
set numDeka to date dekaTrad as date --sets string to numerical
date
set dekaDayofYear to (((numDeka) - (numEndDeka)) div 86400)
set properDekaDoY to characters 2 thru 4 of ((dekaDayofYear + 1000) as
string) --is string
if ((dekaYear div 2) = (dekaYear / 2)) then
set
dekaBiAnnum to "even"
else
set dekaBiAnnum to "odd"
end if
if ((((dekaDayofYear - 1) div 30) + 1) < 12) then
set umOrdinalDeka to ((((dekaDayofYear - 1) div 30) +
1))
else
set umOrdinalDeka to 12
end if
if dekaBiAnnum is "even" then
set dekaUMonth to
character umOrdinalDeka of biEven
else
set dekaUMonth to character umOrdinalDeka of biOdd
end if
set dekaDayofUmonth to ((dekaDayofYear - (umOrdinalDeka * 30) +
30))
set properDekaDoUM to characters 2 thru 3 of ((dekaDayofUmonth + 100)
as string)
set dekaNC to dekaYear + 10000
--defines formatsets content and presentation
set lineSpace to ("
")
set tabFirst to ("
")
set tabSecond to ("
")
set termsICAS to (" per 'ICAS in use'" & tabSecond &
"at
http://www.aatideas.org/itinica/licenses/index.html)")
set icasUCN to ("UCN Calendar")
set icasIDC to ("IDC clock")
set icasICAS to ("UCN calendar and IDC clock")
set tradDay to (tabFirst & "(AD " & yearType & "
year day " & properDayofYear & ")")
set tradDate to (tabSecond & "trad " & zodiacDate &
" " & zodiacWeekday & ")")
set tradDateTime to (tabSecond & "trad " &
zodiacDate & " " & zodiacWeekday & " "
& currentSMH & ")")
set anncUC to ("ICAS Uniform Calendar (UC) date as of:" &
lineSpace)
set dateUCN to (tabFirst & yearNC & uniformMonth &
properDayofUmonth as string)
set dateDekaUCN to (tabFirst & "UCN " & dekaNC &
dekaUMonth & properDekaDoUM as string)
set termsUCN to (lineSpace & tabFirst & "(" &
icasUCN & termsICAS & lineSpace)
set uformDate to (anncUC & dateUCN & " UCN" &
termsUCN & tradDay & tradDate)
set anncIDC to ("ICAS Inter-Dial Clock (IDC) time as
of:")
set tformDeka to (tabSecond & "IDC deka(" & tcodeC &
") t" & properDekaLocal)
set tformZodiac to (tabSecond & "IDC zodiac(" &
tcodeZ & ") t" & properCurrent & ¬
tabSecond & "SMH zodiac(" &
tcodeZ & ") " & currentSMH as string)
set tformUT to (tabSecond & "IDC (UT) t" & properUT
& tabSecond & "SMH (UT) " & currentUTSMH as
string)
set timeDeka to (lineSpace & tabFirst & "deka system of
20 zones:" & tformDeka)
set timeZodiac to (lineSpace & tabFirst & "zodiac system
of 24 zones:" & tformZodiac)
set timeUT to (lineSpace & tabFirst & "universal time:"
& tformUT)
set termsIDC to (lineSpace & tabFirst & "(" &
icasIDC & termsICAS)
set uformTime to (anncIDC & timeDeka & timeZodiac & timeUT
& termsIDC)
set anncICAS to ("ICAS uniform date and time as of:")
set dtformDeka to (lineSpace & dateDekaUCN & " IDC deka("
& tcodeC & ") t" & properDekaLocal as
string)
set dtformZodiac to (lineSpace & tabFirst & "UCN " &
yearNC & uniformMonth & properDayofUmonth & " IDC
zodiac(" & tcodeZ & ") t" & properCurrent
as string)
set termsUCNIDC to (lineSpace & tabFirst & "(" &
icasICAS & termsICAS & lineSpace)
set uformDateTime to (anncICAS & dtformDeka & dtformZodiac &
termsUCNIDC & tradDay & tradDateTime)
--interface
set chooseICAS to
("Select an ICAS formatset for the clipboard:")
display dialog the chooseICAS buttons {"date",
"time", "datetime"}
if the button returned of the result is "date" then
set uformSelect to uformDate
else if the button returned of the result is "time" then
set uformSelect to uformTime
else if the button returned of the result is "datetime"
then
set
uformSelect to uformDateTime
end if
display dialog the uformSelect buttons {"cancel",
"clipboard"} default button 2
if the button returned of the result is "clipboard" then
set the clipboard to the uformSelect
display dialog "The ICAS
formatset is on the clipboard." buttons {"close"}
giving up after 2 default button 1
end if
(* script as of
ICAS uniform date and time as of:
UCN 12005R05 IDC deka(SanJose)
t645
UCN 12005R05 IDC zodiac(PDT)
t653
(UCN calendar and
IDC clock per 'ICAS in use'
at
http://www.aatideas.org/itinica/licenses/index.html)
(AD common year day 095)
trad
2005 April 05 Tuesday 15:41:36)
*)
==== end code _clipboardICAS_ version 0.01 ====
--
email@hidden
http://www.aatideas.org
AAT at www.aatideas.org
1090 B Street, Suite #111
Hayward, California 94541
USA
**********************************************************************
be prepared for an upgrade
to uniform scales of date and time
with AAT ICAS!
**********************************************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden