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

What is time, anyway?

Thread Next
January 29, 2018 19:47
What is time, anyway?
Message ID:
	Basic time question here.  Looking at sites such as, 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.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About