Re: time_t

From: Martijn Schoemaker (martijn@osp.nl)
Date: 11/26/01


"Micken !" wrote:

> Hey, i'm having problems saving the players last logon time to file, I had
> it writing a string to the file but that didn't work. I want to know what
> (with sprintf) corrosponds with time_t, like %s with string and %d with
> integer, what goes with time_t?

Time_t is a 32 bit integer (on most systems) and holds the number of seconds
passed since the Epoch (00:00:00 UTC, January 1, 1970). So the best
(but unreadable way) is to save it as integer.

If you want it in a readable format, use the strftime, asctime ot ctime
functions
which  can convert to readable output, but then you need to convert it back
to time_t using mktime which all ik quite a hassle.

So I'd recommend just saving it as the integer it is.

Cheers,
Aragorn.

Try : imagica.net 4000

--
------ WARNING: This signature contains a VIRUS ! -------
- SHLRUIOHUIOWHLNNMSKHKDLWINDOWSJHFHKJLLUIHEKJLNDHKKJHL -
---------------------------------------------------------

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST