Problem with converting time

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
I am getting different answers based on environment when trying to
convert EPOC seconds to dateitems or internet date.   On my mac I get
the expected result but on a HostM server I get something totally different.

Does any one have a conversion function that does not use the livecode's
convert function that they would be willing to share?

Regards,

     Mike



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
Michael Doub wrote:

 > I am getting different answers based on environment when trying to
 > convert EPOC seconds to dateitems or internet date.   On my mac I get
 > the expected result but on a HostM server I get something totally
 > different.

How different?

 > Does any one have a conversion function that does not use the
 > livecode's convert function that they would be willing to share?

The seconds are usually a very good choice for their compactness and
ease of calculation, and more so because the value we get is in GMT
based on the offset from host OS.

What this should mean is that you can convert values obtained from "the
seconds" and get a good date/time regardless of which time zone you're in.

So seconds are usually ideal (along with "internet date") for network
applications such as the one you're working on.

But for the conversion to take your local system into account, you'll
need to do the conversion locally.

If you're doing the conversion on the server, the date/time will reflect
the time zone settings in the server OS.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
time = 1489755600

Mac:      dateitems = 2017,3,17,9,0,0,6
server:   dateitems = 2017,3,17,12,0,0,6

Code:   get time
convertit to dateitems

I don't understand how the local time comes into play when converting a
constant number of seconds.  The resulting date should be a constant as
well.

What am I missing?

-= Mike


On 3/16/17 4:05 PM, Richard Gaskin via use-livecode wrote:

> Michael Doub wrote:
>
> > I am getting different answers based on environment when trying to
> > convert EPOC seconds to dateitems or internet date.   On my mac I get
> > the expected result but on a HostM server I get something totally
> > different.
>
> How different?
>
> > Does any one have a conversion function that does not use the
> > livecode's convert function that they would be willing to share?
>
> The seconds are usually a very good choice for their compactness and
> ease of calculation, and more so because the value we get is in GMT
> based on the offset from host OS.
>
> What this should mean is that you can convert values obtained from
> "the seconds" and get a good date/time regardless of which time zone
> you're in.
>
> So seconds are usually ideal (along with "internet date") for network
> applications such as the one you're working on.
>
> But for the conversion to take your local system into account, you'll
> need to do the conversion locally.
>
> If you're doing the conversion on the server, the date/time will
> reflect the time zone settings in the server OS.
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
Richard here is another example:

time = 1489752000

mac: dateitems = 2017,3,17,8,0,0,6

server: dateitems = 2017,3,17,12,0,0,6

I just wanted to double check that I was showing you good comparison
since I am copying from multiple windows of debug output.

-= Mike

On 3/17/17 8:46 AM, Michael Doub wrote:

>
> time = 1489755600
>
> Mac:      dateitems = 2017,3,17,9,0,0,6
> server:   dateitems = 2017,3,17,12,0,0,6
>
> Code:   get time
> convertit to dateitems
>
> I don't understand how the local time comes into play when converting
> a constant number of seconds.  The resulting date should be a constant
> as well.
>
> What am I missing?
>
> -= Mike
>
>
> On 3/16/17 4:05 PM, Richard Gaskin via use-livecode wrote:
>> Michael Doub wrote:
>>
>> > I am getting different answers based on environment when trying to
>> > convert EPOC seconds to dateitems or internet date.   On my mac I get
>> > the expected result but on a HostM server I get something totally
>> > different.
>>
>> How different?
>>
>> > Does any one have a conversion function that does not use the
>> > livecode's convert function that they would be willing to share?
>>
>> The seconds are usually a very good choice for their compactness and
>> ease of calculation, and more so because the value we get is in GMT
>> based on the offset from host OS.
>>
>> What this should mean is that you can convert values obtained from
>> "the seconds" and get a good date/time regardless of which time zone
>> you're in.
>>
>> So seconds are usually ideal (along with "internet date") for network
>> applications such as the one you're working on.
>>
>> But for the conversion to take your local system into account, you'll
>> need to do the conversion locally.
>>
>> If you're doing the conversion on the server, the date/time will
>> reflect the time zone settings in the server OS.
>>
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
On 03/17/2017 05:46 AM, Michael Doub via use-livecode wrote:

> time = 1489755600
>
> Mac:      dateitems = 2017,3,17,9,0,0,6
> server:   dateitems = 2017,3,17,12,0,0,6
>
> Code:   get time
> convertit to dateitems
>
> I don't understand how the local time comes into play when converting a
> constant number of seconds.  The resulting date should be a constant as
> well.
>
> What am I missing?

That seems reasonable to me.
<disclaimer>
   I haven't been following this discussion
</disclaimer>

"get the time" will get a value based on the system's local time zone,
so what you're thinking of as a constant is actually dependent on the
system location. It looks to me like the server is three time zones away
from the mac. If you don't want time zones to enter into the calculations

get the internet date
convert it to dateitems

--
  Mark Wieder
  [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
Michael Doub wrote:

 > time = 1489755600
 > Mac:      dateitems = 2017,3,17,9,0,0,6
 > server:   dateitems = 2017,3,17,12,0,0,6
 >
 > Code:   get time
 > convertit to dateitems
 >
 > Richard here is another example:
 > time = 1489752000
 > mac:    dateitems = 2017,3,17,8,0,0,6
 > server: dateitems = 2017,3,17,12,0,0,6
 >
 > I just wanted to double check that I was showing you good comparison
 > since I am copying from multiple windows of debug output.
 >
 > I don't understand how the local time comes into play when converting
 > a constant number of seconds.  The resulting date should be a
 > constant as well.
 >
 > What am I missing?

The beauty of "the seconds" is that the value you get is in GMT,
regardless of where the machine is at the moment that value of obtained.
  It does the offset according to the locale settings on the local machine.

"The seconds" and "the internet date" are the only two forms that take
local time zone settings into account.

The benefit with this approach is that either can be used in
applications where usage may span time zones but you need to maintain
time stamps that will work across any time zones.


For example, suppose I'm in Los Angeles and I share a server app with
one user in New York, another in Brisbane, and another in Edinburgh.

GMT offsets for each are:

Edinburgh: 0
New York: -4h
Los Angeles: -7h
Brisbane: +10h (they're across the International Dateline)

The "internet date" format reflects this explicitly, noting the GMT
offset at the end of the string it returns:

   Fri, 17 Mar 2017 09:09:03 -0700

But "the seconds" of course is just an integer, so while the GMT offset
has also been accounted for it's less evident.

If all four of us get "the seconds" at the same moment, the value we get
will be the same, in GMT time.

But since only one of us is actually in the GMT time zone, how does it
know?  That's where the local system settings come into play.

When *obtaining* either "the seconds" or "the internet date", local time
zone is used to create a value that can be understood globally.

When *converting* either "the seconds" or "the internet date", LC uses
time conversion routines dependent on the system locale settings of the
machine where the conversion is taking place.

With "the internet date" the time zone is explicitly included, so it
adjusts from that GMT offset to bring it into alignment with the GMT
offset in the local OS.

With "the seconds", the value is already adjusted to be GMT, so
conversion adjusts it again for the local settings to deliver an
accurate representation of that moment in local time.


In the example above, all four users would get the same value from
querying "the seconds" at the same moment, no matter where they are in
the world.

And when my software needs to display the date and/or time in
human-readable form, the "convert" command takes local settings into
account to deliver an accurate representation that makes sense in local
time.

So if I modify a record right now, in my system it'll show March 17 at
9:18 AM.  But when my Brisbane use sees the modification date that I've
stored using "the seconds", he'll see March 18 at 2:18 AM, which is the
same global moment.


In short:

The key to getting accurate reflections of time is to store either "the
seconds" or "the internet date" on the server (or really, anywhere
timestamps may be shared across time zones), and then do any conversions
needed for human readability locally.

If you do a conversion from either of those two formats on the server to
any other format, the result will be correct for the server's locale,
but unless you're nearby probably not correct for you.


Quick Exercise:

It took me a while (and some experimentation) to appreciate that "the
seconds" reflects GMT just as "the internet date" does, something I
learned from Sarah Reichelt back in the day.

One quick way to verify this is to check while changing your local
machine's Date and Time settings:

Set to Los Angeles: 1489768020
5 seconds later,
Set to Montreal:    1489768025
10 seconds after that,
Set to London:      1489768035

Except for the few seconds it took me to click on my Locale map in my
Control Panel, the numbers are effectively all the same.

Once I became confident with that, I've used it for everything on
servers ever since (except logging - I like the built-in readability of
"internet date" in logs).

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
Sorry guys, I must not have been clear in my statement of the problem.  
Here is the code:

put 1489755600 into tVar
convert tVar into dateitems
  -- on the mac tVar contains 2017,3,17,9,0,0,6
  -- on the server tVar contains 2017,3,17,12,0,0,6

The local time should not be involved since you are converting a fixed
value.  What is happening?

-= Mike


On 3/17/17 12:44 PM, Richard Gaskin via use-livecode wrote:

> Michael Doub wrote:
>
> > time = 1489755600
> > Mac:      dateitems = 2017,3,17,9,0,0,6
> > server:   dateitems = 2017,3,17,12,0,0,6
> >
> > Code:   get time
> > convertit to dateitems
> >
> > Richard here is another example:
> > time = 1489752000
> > mac:    dateitems = 2017,3,17,8,0,0,6
> > server: dateitems = 2017,3,17,12,0,0,6
> >
> > I just wanted to double check that I was showing you good comparison
> > since I am copying from multiple windows of debug output.
> >
> > I don't understand how the local time comes into play when converting
> > a constant number of seconds.  The resulting date should be a
> > constant as well.
> >
> > What am I missing?
>
> The beauty of "the seconds" is that the value you get is in GMT,
> regardless of where the machine is at the moment that value of
> obtained.  It does the offset according to the locale settings on the
> local machine.
>
> "The seconds" and "the internet date" are the only two forms that take
> local time zone settings into account.
>
> The benefit with this approach is that either can be used in
> applications where usage may span time zones but you need to maintain
> time stamps that will work across any time zones.
>
>
> For example, suppose I'm in Los Angeles and I share a server app with
> one user in New York, another in Brisbane, and another in Edinburgh.
>
> GMT offsets for each are:
>
> Edinburgh: 0
> New York: -4h
> Los Angeles: -7h
> Brisbane: +10h (they're across the International Dateline)
>
> The "internet date" format reflects this explicitly, noting the GMT
> offset at the end of the string it returns:
>
>   Fri, 17 Mar 2017 09:09:03 -0700
>
> But "the seconds" of course is just an integer, so while the GMT
> offset has also been accounted for it's less evident.
>
> If all four of us get "the seconds" at the same moment, the value we
> get will be the same, in GMT time.
>
> But since only one of us is actually in the GMT time zone, how does it
> know?  That's where the local system settings come into play.
>
> When *obtaining* either "the seconds" or "the internet date", local
> time zone is used to create a value that can be understood globally.
>
> When *converting* either "the seconds" or "the internet date", LC uses
> time conversion routines dependent on the system locale settings of
> the machine where the conversion is taking place.
>
> With "the internet date" the time zone is explicitly included, so it
> adjusts from that GMT offset to bring it into alignment with the GMT
> offset in the local OS.
>
> With "the seconds", the value is already adjusted to be GMT, so
> conversion adjusts it again for the local settings to deliver an
> accurate representation of that moment in local time.
>
>
> In the example above, all four users would get the same value from
> querying "the seconds" at the same moment, no matter where they are in
> the world.
>
> And when my software needs to display the date and/or time in
> human-readable form, the "convert" command takes local settings into
> account to deliver an accurate representation that makes sense in
> local time.
>
> So if I modify a record right now, in my system it'll show March 17 at
> 9:18 AM.  But when my Brisbane use sees the modification date that
> I've stored using "the seconds", he'll see March 18 at 2:18 AM, which
> is the same global moment.
>
>
> In short:
>
> The key to getting accurate reflections of time is to store either
> "the seconds" or "the internet date" on the server (or really,
> anywhere timestamps may be shared across time zones), and then do any
> conversions needed for human readability locally.
>
> If you do a conversion from either of those two formats on the server
> to any other format, the result will be correct for the server's
> locale, but unless you're nearby probably not correct for you.
>
>
> Quick Exercise:
>
> It took me a while (and some experimentation) to appreciate that "the
> seconds" reflects GMT just as "the internet date" does, something I
> learned from Sarah Reichelt back in the day.
>
> One quick way to verify this is to check while changing your local
> machine's Date and Time settings:
>
> Set to Los Angeles: 1489768020
> 5 seconds later,
> Set to Montreal:    1489768025
> 10 seconds after that,
> Set to London:      1489768035
>
> Except for the few seconds it took me to click on my Locale map in my
> Control Panel, the numbers are effectively all the same.
>
> Once I became confident with that, I've used it for everything on
> servers ever since (except logging - I like the built-in readability
> of "internet date" in logs).
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
On 03/17/2017 01:20 PM, Michael Doub via use-livecode wrote:

> Sorry guys, I must not have been clear in my statement of the problem.
> Here is the code:
>
> put 1489755600 into tVar
> convert tVar into dateitems
>  -- on the mac tVar contains 2017,3,17,9,0,0,6
>  -- on the server tVar contains 2017,3,17,12,0,0,6
>
> The local time should not be involved since you are converting a fixed
> value.  What is happening?

Sorry - I can't replicate that.
With the desktop and server engines running on the same machine,

put 1489755600 into tVar
convert tVar into dateitems

gives me
IDE message box: 2017,3,17,6,0,0,6
server:          2017,3,17,6,0,0,6

Note that "convert into" is not supported.
It might be better to post the code you're actually using.

--
  Mark Wieder
  [hidden email]



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
Michael Doub wrote:
 > Sorry guys, I must not have been clear in my statement of the
 > problem.
 > Here is the code:
 >
 > put 1489755600 into tVar
 > convert tVar into dateitems
 >   -- on the mac tVar contains 2017,3,17,9,0,0,6
 >   -- on the server tVar contains 2017,3,17,12,0,0,6
 >
 > The local time should not be involved since you are converting a
 > fixed value.  What is happening?

Humor me: what city is your server in, and what city are you in?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
I am in Chapel Hill,  NC.   I am using Hostm and I really don't know,   I would have expected the time to be less if on the west coast of the US.  

Mike


  Original Message  
From: [hidden email]
Sent: March 17, 2017 5:30 PM
To: [hidden email]
Reply-to: [hidden email]
Cc: [hidden email]
Subject: Re: Problem with converting time

Michael Doub wrote:

> Sorry guys, I must not have been clear in my statement of the
> problem.
> Here is the code:
>
> put 1489755600 into tVar
> convert tVar into dateitems
>   -- on the mac tVar contains 2017,3,17,9,0,0,6
>   -- on the server tVar contains 2017,3,17,12,0,0,6
>
> The local time should not be involved since you are converting a
> fixed value.  What is happening?

Humor me: what city is your server in, and what city are you in?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
Sorry Mark and Richard.   Here is the real code snipit that includes a
hack that seems to work:

getaData[x]["time"]
if not(theenvironmentisamongtheitems"development,standalone
application") then
     subtract(4*60*60) fromit
end if
convertit todateitems

Mark, in your situation, you and the server are in the same timezone so
I would not expect to see a problem.   I have no idea where my server
is, but it must not be in my timezone.  I am guessing on the west coast
since taking off 4 hours seems to fix the problem.

It still does not make any sense why a timezone comes into play at all.

Here is the silly little app:   Http://tarwheels.net/weather   It has
been really cold  here the last few days and I was not able to cycle, so
this was a fun diversion.  Seems to work, but it has not had much
testing.  And as you can see I know next to nothing about making things
look nice in html.

-= Mike


On 3/17/17 4:42 PM, Mark Wieder via use-livecode wrote:

> On 03/17/2017 01:20 PM, Michael Doub via use-livecode wrote:
>> Sorry guys, I must not have been clear in my statement of the problem.
>> Here is the code:
>>
>> put 1489755600 into tVar
>> convert tVar into dateitems
>>  -- on the mac tVar contains 2017,3,17,9,0,0,6
>>  -- on the server tVar contains 2017,3,17,12,0,0,6
>>
>> The local time should not be involved since you are converting a fixed
>> value.  What is happening?
>
> Sorry - I can't replicate that.
> With the desktop and server engines running on the same machine,
>
> put 1489755600 into tVar
> convert tVar into dateitems
>
> gives me
> IDE message box: 2017,3,17,6,0,0,6
> server:          2017,3,17,6,0,0,6
>
> Note that "convert into" is not supported.
> It might be better to post the code you're actually using.
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
Mike Doub wrote:

 > I am in Chapel Hill,  NC.   I am using Hostm and I really don't
 > know,   I would have expected the time to be less if on the west
 > coast of the US.

We don't yet know the location of the server, but even better you can
find out what time zone it's set to by logging in via SSH and running:

date +%Z

If you're running the convert command on the server I think you'll find
the converted output differs from your local conversion by the number of
time zones between you and the server.

I took the time to write this, maybe worth reading and trying the
exercise I included near the end:
http://lists.runrev.com/pipermail/use-livecode/2017-March/235470.html

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
On 03/17/2017 03:52 PM, Michael Doub via use-livecode wrote:
> Sorry Mark and Richard.   Here is the real code snipit that includes a
> hack that seems to work:
>
> getaData[x]["time"]
> if not(theenvironmentisamongtheitems"development,standalone
> application") then
>     subtract(4*60*60) fromit
> end if
> convertit todateitems

Weird copypasta stuff with spaces there.

>
> Mark, in your situation, you and the server are in the same timezone so
> I would not expect to see a problem.   I have no idea where my server
> is, but it must not be in my timezone.  I am guessing on the west coast
> since taking off 4 hours seems to fix the problem.

That just sounds wrong. If anything, it should be the other way around.

>
> It still does not make any sense why a timezone comes into play at all.

Timezone enters into the picture because if you ask the time, and then
convert it to a readable format, you wouldn't expect to see UTC time
unless you happened to live in that time zone. You're asking the server
"what time is it where you live?" and asking the mac the same thing. The
answers may or may not differ. If you want to be able to compare
timestamps then "the internet date" will give you UTC time for both.

--
  Mark Wieder
  [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
On 03/17/2017 03:52 PM, Michael Doub via use-livecode wrote:
>
> getaData[x]["time"]

Wherever the array is getting its time data, that's where local time is
happening.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
Hmm, this is odd if you are located in North Carolina…it means your server is off shore, out in the Atlantic, because it is running 3 hours ahead of you. but, unless HostM has now floatilla ISP data center ships, or secret bunkers on the sea floor, something is amiss.

Ditto everything Richard already said Thanks Richard! Your prolific penchant for mentoring/documentation is really appreciagted!  I saved all that to my reference here…

put 1489755600 into tVar
convert tVar into dateitems
   -- on the mac tVar contains 2017,3,17,9,0,0,6  # North Carolina
   -- on the server tVar contains 2017,3,17,12,0,0,6 # Huh!  three hour ahead ?

Am I daft? this seem impossible as this indicates 9 am in NC = 12 noon on the server.

I had issues a long time ago, because the ISP would spin up an instance of Linux using a disk image--  some generic OS image. They never bothered to reset the time zone for the OS…many ISP tech's  assume the user is savvy -- "Well, it's your server, set it up the way you like it.") and will want to do that themselves.  

But naïve users don’t give it a second thought and I got these weird results until I checked, like Richard suggested, the time and zone on the server itself and reset them. There was a time when I thought it would be cool to set the time zone of the OS in California to the same time zone as Hawaii (local) but later this turned about to be a bad strategy because, really, like Richard said, you want everything to be "the same moment" around the global, which of course means, the time in each location, for that moment will be different.   Any other way…  "therein lies madness"  

I had to master the simple "art" of understanding GMT and local conversions.  So if your host is in Texas, make sure the TZ/Time on the "box" is correct for its real, physical locationin Dallas or where ever… and then if you want the web page to "pretend" the server is in NC, you would add time to the output. (or subtract time from your inputs in your scripts.)

interesting related resource : https://www.epochconverter.com/

https://www.epochconverter.com/clock

BR


 



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with converting time

pink
My experience is that HostM's time is set to GMT

when I run:
put 1489755600 into tVar
convert tVar into dateitems
put tVar

I get: 2017,3,17,13,0,0,6
---
Greg (pink) Miller
mad, pink and dangerous to code
Loading...