Jump to content
Sign in to follow this  
Greg Hains

Time zone query

Recommended Posts

Hi.

This is not strictly an FMS question, but...

I have two sites accessing a server - all three are in different time zones in Australia. As certain transactions are made in the database, a log entry is sent back to a log table on the server which - in itself - works fine. The problem I am having is that the server records it's own time which will differ from that of the client. Sure, I can send the timestamp of the client event t to the log rather than using the record_created timestamp of the server, but then the log will be out of sequence depending on the difference of the time zones.

The advantage to date of using the server's record_created time stamp is that is is in order, but doesn't reflect that of the client date and time.

Has anybody got any bright ideas as to how I could manage this a little better?

Cheers,

Greg

Share this post


Link to post
Share on other sites

Keep a record of BOTH server and client times for creation time.

  • Like 1

Share this post


Link to post
Share on other sites

When I have to do this, I just add the time difference.

Share this post


Link to post
Share on other sites

Thanks IdealData - I could do that, but would still have to do some translation of events. I guess I was looking for something like a routine that knew about time zones and could interpret them.

Agnes. I thought about that, but with daylight saving, the time zones change twice a year.

I thank you both for your input - I will work with both ideas.

Cheers,

Greg

Share this post


Link to post
Share on other sites

All I can suggest is an auto-enter with Get ( CurrentHostTimeStamp ) to log the client actions on the client side. At any time you can convert that time to determine client's actual time. If you normalize the systems to the server first then there will be no conflict. A calc can convert for their display.

Edited by LaRetta

Share this post


Link to post
Share on other sites

FileMaker 12 has an undocumented Get ( UTCmSecs ) function. You can use GetAsTimestamp ( Get ( UTCmSecs ) / 1000 ) to enter UTC (or the closest approximation to UTC that the creating device can muster), which will take account of a device's time zone. (I haven't tested how it behaves if the clock or time zone settings on a device are incorrect.) You can use this to either calculate a different time for the log or to derive the time zone of each client. The trouble with Get ( UTCmSecs ) is that, as an undocumented function, we don't know that it will continue to work in future updates and versions. If you like it as much as I do, put in a feature request to either keep Get ( UTCmSecs ) or give us a working substitute.

Share this post


Link to post
Share on other sites

I run over a cool triick

 

use a applescript to write the UTC timezone into your file. 

 

 set timeZone to do shell script "date +%z"

set numero to timeZone as number
set nreal to numero / 100
set inteiro to nreal as integer
tell application "FileMaker Pro Advanced"
tell document "YOUR FILE"
tell current layout
tell current record
set cell "YOUR TIMEZONE FIELD" to inteiro
end tell
end tell
end tell
end tell

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.