Mail Archives: djgpp/2001/05/06/02:21:00
On Sat, 5 May 2001, Rafal Maj wrote:
> Is there some function that will represent time in seconds ?
Yes, it's called `time', and you already found it.
> If I remember
> correct, ther was some functions return date as seconds after 1972.??.?? or
> something like that.
`time' returns the amount of seconds since 00:00:00 GMT on Jan 1,
1970.
> I have found function time()... but I have problems with it:
> printf("Time is %d\n", time(0));
> This won't compile in C++ and will in C. Why ? How to compile in C++ ?
What were the compiler error messages?
Did you include <time.h>?
Also note that `time' returns a time_t object, so C++ might object to
printing it with a %d. Try %u instead.
- Raw text -