develooper Front page | perl.beginners | Postings from January 2018

What is time, anyway?

Thread Next
From:
SurfShop
Date:
January 29, 2018 19:47
Subject:
What is time, anyway?
Message ID:
25C5F513-28C0-4F5F-B783-8AD570DA9142@surfshopcart.com
	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
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About