Script to Generate Concurrent Times
Brahmanathaswami
brahma at hindu.org
Thu Jan 15 22:02:47 EST 2015
Roger Eller wrote:
> So that's where the old saying, "your singing would bring a jersey cow to
> tears" comes from.<g>
LOL!
Hmmm back on topic:
Requirement: Generate current time list for a *future* time (for
scheduled webinar)
OK, so it is easy enough to get world time from the linux system.
and FYI: LC "internet date" is, happily, using the standard RFC 2822
format and we can invoke this also in the shell:
-R, --rfc-2822
output date and time in RFC 2822 format. Example: Mon,
07 Aug
2006 12:34:56 -0600
Check it out now
http://dev.himalayanacademy.com/tests/dates.lc
-----------
?lc
# copied the list from html source at:
# http://www.timezoneconverter.com/cgi-bin/tzc.tzc <http://www.timezoneconverter.com/cgi-bin/tzc.tzc>
put url "file:/home/devhap/public_html/tests/zones.txt" into tZones
repeat for each line x in tZones
set the itemdel to "/"
if (the number of items of x) = 1 then
put x into tCity
else
put item 2 of x into tCity
end if
put x into $TZ
put shell("date -R") into tDTstring
put tCity& ": "& tDTstring& "<br />" after tWorldTimes
end repeat
put tWorldTimes
-----------------
but that doesn't actually meet my requirement.
Sure: We get all the times to answer "what time is it now?"
But what if I want to a future time e.g. February 1, 1:30PM HST
and get a list of all dates/times across the globe that are concurrent with that future date/time?
Maybe I'll ask that on Expert's Exchange... man timezone isn't getting me anything.
I suppose one algorithm using LC native timedate conversion tools could be.
(the future date in seconds) - (Current time in seconds local time) = advanceToFutureIncrement
repeat for each concurrent time for now for all cities
put (city[x] Time Right Now) + advanceToFutureIncrement into tFutureWebinarTimeInCity[x]
put tFutureWebinarTimeInCity[x] & "<br />" after tListOfNextWebinarTimes
end repeat
of course the above needs a bit more code, but not much more...
Brahmanathaswami
More information about the use-livecode
mailing list