At 12:06 1/26/01, Michael C. Hanson wrote:
>Does Lingo have any function for getting UTC?
>More specifically, getting the time in seconds
>since 1/1/1970 ?

Warning! This post has lots of secs in it ;-)

I don't think it's built in, but it's easy enough to create. Here are two 
scripts that should do the trick.

The first script is smart enough to know if the user has their region 
settings displaying in 12-hour format, but it could be vulnerable to other 
languages/localizations. The second script uses Buddy API to get the time 
in a predictable format regardless of language. Both scripts use 'the 
systemDate' with math to get the number of days since date(1970,1,1).

on UTC
   today = the systemDate
   numDays = today - date(1970,1,1)
   daySecs = numDays * (24 * 60 * 60)

   now = the long time
   oldDelim = the itemDelimiter
   the itemDelimiter = ":" -- different in other countries?
   hrs = value(now.item[1])
   mins = value(now.item[2])
   secs = value(now.item[3])
   the itemDelimiter = oldDelim
   if now.word[2] = "PM" then
     hrs = hrs + 12
   end if

   hrSecs = hrs * (60 * 60)
   minSecs = mins * 60
   totalSecs = daySecs + hrSecs + minSecs + secs

   return totalSecs
end

on UTCbuddy
   today = the systemDate
   numDays = today - date(1970,1,1)
   daySecs = numDays * (24 * 60 * 60)

   hrs = value(baSystemTime("%H"))
   mins = value(baSystemTime("%M"))
   secs = value(baSystemTime("%S"))

   hrSecs = hrs * (60 * 60)
   minSecs = mins * 60
   totalSecs = daySecs + hrSecs + minSecs + secs

   return totalSecs
end

I seem to recall that there's an undocumented feature with the systemDate 
in D8 that can return time in a standard format. If you don't have Buddy 
API, see if you can get the hours, minutes, and seconds from the systemDate().

Buddy API is available at http://www.mods.com.au


--
Mark A. Boyd
Keep-On-Learnin' :)


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to