YOu might look at localtime()
perldoc.perl.org/functions/localtime.html

or gmtime
perldoc.perl.org/functions/gmtime.html

time() returns the epoch time - seconds since Jan 1, 1970 UTC (IIRC),
localtime transforms it to just that.  So all your time() stamps will be
the same and localtime() can turn them into a valid local version but if
they're from all over, they won't have the TZ info, so you'd have to handle
that if you wanted to know "when" it happened where ever it actually
happened. Hmmm, that may not matter ;->

a

On Mon, Jan 29, 2018 at 1:46 PM, SurfShop <contactat...@surfshopcart.com>
wrote:

>         Basic time question here.  Looking at sites such as
> http://perldoc.perl.org/functions/time.html, I'm not seeing what the
> time() function is based on.  Does it return the time of the server, or
> UTC?  Is it affected by any timezone setting on the server or in a script?
>
>         I tested it in a script and the result didn't change when I added
> a timezone, so it doesn't look like that affects it.  I also ran that
> script on both my server, which is in the EST timezone, and on my laptop,
> which is in the MST timezone, and I got the same answer.  I'm pretty sure
> that mean it's UTC, but I'd like some assurance.
>
>         The reason I'm asking is that I want to be certain that if I use
> time() in multiple scripts, they will all be based on the same 'source' so
> that any timestamp comparisons will be accurate.  If there's a possibility
> that they won't be the same, then I'll need to convert them so that they
> will be the same.
>
> Thanks,
> Frank
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>


-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to