Rich,
Since I'm a new member on this forum, my posts are
always pending review before they appear on the forums.
So... by the time you read this, I'm sure Ancient Lady
has already given you a reply.. but I'll post anyway.
REVIEW OF PREVIOUS CODE SNIPPET
In your code snippet, your time offset is "-5", right?
str(val(left(time$, 2))-5)
What you're doing there, is grabbing the hour part from the
time string, converting it to a value, and subtracting
5 from it (the hardcoded time offset of -5).
If the current time is "01:15:30", for example, what do
you think your adjusted hour will now be?
It won't be "20", it'll be "-4".
You're code snippet is just simply WRONG. Don't use
code like that.
WRAP AROUND
Your code snippet does not properly take into account
how the time will wrap around at the beginning or end
of a day with a positive or a negative time offset.
The functions provided by Ancient Lady properly account
for this wrap-around, and are general purpose functions
withour any hard-coded offset. So you can pretty much
copy/paste them to any code and just call, for example:
Although, I do think the second parameter of Ancient Ladys
"getLocalTime" function should be properly documented,
since, if I am not mistaken, dst offsets can sometimes
be only 30 minutes in some regions. In which case
the is_dst param must be passed as "0.5" (= 30 minutes).
Ancient Ladys code fully accounts for that, but it
isn't very obvious from the parameter naming.
Cheers,
AgentSam