Is this legit? [POSIX]
Is this legit? [POSIX]
- Subject: Is this legit? [POSIX]
- From: "Nigel Garvey" <email@hidden>
- Date: Wed, 23 Jul 2008 16:14:55 +0100
I've been looking for a way to get the name of the time zone in which a
machine's currently operating (eg. "Europe/London"). While following
clues in parts of the system where I don't normally venture, I've noticed
that if I coerce "/etc/localtime" to POSIX file, the reference changes to
the current time zone file:
file "PowerBook HD:usr:share:zoneinfo:Europe:London"
I can coerce this to Unicode text (to avoid some ambiguity with the POSIX
file) and get the POSIX path of the result, which gives a text ending
with the very information I want:
set tzPath to POSIX path of ("/etc/localtime" as POSIX file as Unicode text)
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "zoneinfo/"
set tz to text item 2 of tzPath
set AppleScript's text item delimiters to astid
tz --> "Europe/London"
This works for other time zones too. But is the "/etc/localtime" coercion
trick a legitimate usage, or is it just something that happens to work in
Tiger and Jaguar?
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden