Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.


1004 - How can I determine the local time relative to where a piece is running?

by - Joseph Ganci

We are developing off-line courseware, which will communicate with a LMS (when the user goes on-line the results will be sent to the LMS).

The course will be taken all over the world, so I don't know what time it will be (locally) when a user is taking the course. One of the screens must show the current time in Berlin/Germany, I show you a part of the text:

"Meet your teacher and other students for a discussion. Each round of discussion lasts 30 minutes. Discussion forums are offered hourly. The discussion is based on the material from Lesson 1.

Before beginning, please note the following points: Introduce yourself when you enter! (name, location) The times listed are for 'Berlin/Germany'. In Berlin it is now:"

I hope you know now what I mean...

I think the simplest fix is to ask the students what time zone they are currently in. There is, I think, a time zone setting on computers, but you would have to depend on your users being able to set this and remembering to reset it when they move with their computers, rather than just changing the time.

However, if you are fairly confident that they have the time of day set correctly on their system, then this code works on my system, through the BudAPI U32 or XTRA:

timezone := baReadRegString("SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation","StandardName", 0, "HKEY_LOCAL_MACHINE")

Timezoneinfo := baReadRegString("SOFTWARE\\Microsoft\\WindowsNT\\CurrentVersion\\Time Zones\\"^timezone, "Display", 0, "HKEY_LOCAL_MACHINE")

GMTdifference := GetNumber(1, Timezoneinfo) + GetNumber(1, SubStr(Timezoneinfo, Find(":", Timezoneinfo), CharCount(Timezoneinfo))) / 60

Note that the first line above obtains the name of the current time zone. I then use that in the second line to obtain the local setting for the time zone. However, note that I'm specifically targeting Windows NT here since I'm running Windows 2000. There's probably a more generic way of obtaining this but I'm out of time so maybe someone else can provide a more generic way.

The third line grabs the GMT difference, which will tell you what the difference is between your time zone and Greenwich, England. If you know how many hours difference it is between your target and Greenwich, you're golden. For instance, you know that Germany is +1 hours GMT, so the difference between Washington, DC, and Germany is +6. BTW, I'm not taking into account Daylight Savings Time.

On my machine, these are the values of the three variables above:

timezone = "Eastern Standard Time"
Timezoneinfo = "(GMT -5:00)Eastern Time (US & Canada)"
GMTdifference = -5
Note that I am checking for the value after the colon in Timezoneinfo because some time zones are set to the half-hour. For instance, India Standard Time is +5.5 (5 and a half hours) ahead of GMT.

There are 0 reviews
Add your review