T
Tivo Escobar
Hi all,
anybody here can tell me what exactly is returned by the standard
function time() in <ctime> (or time.h). Please dont tell me it is the
number of seconds since 1 Jan of 1970 GMT, cos it is not (at least not
in my case!).
If I pass this number to a Java program (print it using a
java.util.Date() object), the result is the current date minus one
hour. If I generate the current number of seconds since 1970 in a Java
program and use it in a C++ program (print it using localtime and
asctime), the result is the current date plus one hour. I tested it
changing the time zone of my computer and the results were the same.
My conclusions are:
1. time() returns the number of seconds since 1 Jan 1970 GMT minus one
hour;
2. localtime() adjusts the date above to the correct localtime (sum
one hour) and store it in a structure.
Does anybody know if I am right? If yes, why was it implemented that
way?
Thanks in advance,
Tivo
anybody here can tell me what exactly is returned by the standard
function time() in <ctime> (or time.h). Please dont tell me it is the
number of seconds since 1 Jan of 1970 GMT, cos it is not (at least not
in my case!).
If I pass this number to a Java program (print it using a
java.util.Date() object), the result is the current date minus one
hour. If I generate the current number of seconds since 1970 in a Java
program and use it in a C++ program (print it using localtime and
asctime), the result is the current date plus one hour. I tested it
changing the time zone of my computer and the results were the same.
My conclusions are:
1. time() returns the number of seconds since 1 Jan 1970 GMT minus one
hour;
2. localtime() adjusts the date above to the correct localtime (sum
one hour) and store it in a structure.
Does anybody know if I am right? If yes, why was it implemented that
way?
Thanks in advance,
Tivo