4 Replies Latest reply on Sep 12, 2006 9:47 AM by crazyjoemilan

    World Clock

    mac_monkey
      Hi,

      I'm starting to think about how to code a world clock in actionscript. I'd like to have times for up to 5 locations. I was wondering if it is possible to connect to a time server and tell it a location, or use the time server's location and work out the difference or whether it was best to use the time on the user's system (which seems very wrong to me)

      Basically my main thinking point is how to get the time....?

      Any help appreciated :-)
        • 1. Re: World Clock
          crazyjoemilan Level 2
          you can get the time using ActionScript, but as far as I know thats just local. So all those people with broken clocks will be very confused.

          Instead, I'd use a php script to get the server time from whichever zone you're in. From there I'd just use AS to line up the correct times with zones. I think that'd be the easiest way to do it.
          • 2. Re: World Clock
            mac_monkey Level 1
            How would I get the value from the php to the flash movie with enough accuracy?

            Will passing the time in as a parameter in the <object> tag be sufficient. I guess what I'm saying is, is there anything I can do to keep the time accurate with things which can cause delays such as page loading etc.
            • 3. Re: World Clock
              rquantin Level 1
              You load the php only one time, the seconds have the same duration for every location :)
              • 4. Re: World Clock
                crazyjoemilan Level 2
                indeed he spits the troof.

                You can also run a check to see if the users clock year is less than 2000 before you run the script. Generally, when peoples' clocks are off, they're set at 1970 or something near there because their clock battery is dead. Anyway, so if you wanted to get around the php file, you could load the clocks only if the year looks reasonable, otherwise it could say "Your clock is broken!"