Finding UTC

Graham Samuel livfoss at mac.com
Sun Feb 21 14:34:40 EST 2016


Thanks to all those who replied - ‘the internet date’ was the answer I needed, since I then didn’t have to get out of my LiveCode comfort zone to do the calculation. I’m thinking of time-stamping some interactions that are going to go through a program I’m running on LiveCode Server. Right now I have it running on DreamHost, whose servers presumably stay in one place, but I wanted an invariant time stamp not depending on the location of the server or of any particular user, so I saw UTC as the way to go.

My issue was that I didn’t know of a command that I could run on the server, or a url to a public time server, that would just give me UTC in its simplest form without leaving LiveCode - probably very lazy of me, but I want to keep things as simple as I can. I have now written a little homegrown routine that uses ‘the internet date’ which seems to work fine.

Thanks again

Graham

> On 20 Feb 2016, at 19:09, Sannyasin Brahmanathaswami <brahma at hindu.org> wrote:
> 
> On February 20, 2016 at 6:50:55 AM, Earthednet-wp (prothero at earthednet.org<mailto:prothero at earthednet.org>) wrote:
> This will of course put the time as perceived by the server where in the world my copy of LCS happens to be hosted. Given that this is arbitrary from the point of view of a user of the server, it would be easier for me if I could show the time as UTC, or what us Brits used to call Greenwich Mean Time.
> 
> I may be missing thing, but unless your server is a nomad, it is always exactly X numbers away from UTC...  sothen what is the issue?
> 
> Forgive me if I'm stating the obvious and don't grasp your problem:
> 
> UTC is UTC wherever you are.  If I query for UTC in Hawaii, or California or London, we get the same value...So all you need is a small API script on the server to return UTC to you... and typically you have control over the time setting on your "box"  so if you want the server to return UTC...you have to be sure (unix/linux) tzdata(cmd line app) is installed.. run that and you will be prompted to set your time zone. set "GST-0"  and you are good to go.
> 
> This assumes of course that's what you want...it may not be... I prefer, e.g. that the server return the time of the place where it lives (otherwise I get crazy confused)... this is, as you say, arbitrary, since we have users all over the planet in all time zones... but though I am in Hawaii, I like the server in California to be on California time... as this is how we think out here in the middle of the Pacific...CA is three hours ahead, Texas is 4, Chicago 5, NY 6  etc.. (depends on DLS)  if I want my LCS on the server to return UTC, then I just add the offset to PST  (+8) since he lives in Californai and is not moving around.
> 
> https://codeghar.wordpress.com/2007/12/06/manage-time-in-ubuntu-through-command-line/https://en.wikipedia.org/wiki/List_of_UTC_time_offsets
> 
> if you do not have control of the server box/instance then you only have the option to add the offset to GMT to the server time... a simple "add" in your script...  Through the years, in my experience, default installations of web server OS's often have some odd time default, and you only discover this one day when you see weird time stamps.. so you have to go in and correct it. This is getting better with cloud computing, but in the old days the "instance" on a box was initiated by loading an image from a CD, and the service selling you the web services didn't even bother to check that the image had some wrong TZ for the location where it was being installed.
> 
> BR
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list