Hi… i would like to know how i can get the time and day.
I have to make some files named “time_day”.txt
I looked in the time.h in sdl but i didn’t understand it welll.
Help
Thx
This isn’t an SDL question. Track down the C Programming FAQ (it’s both
in book form, and online), and I believe you’ll find the answer.
Good luck!
-bill!On Mon, May 06, 2002 at 04:03:39PM +0200, Olivier Caignart wrote:
Hi… i would like to know how i can get the time and day.
I have to make some files named “time_day”.txt
I looked in the time.h in sdl but i didn’t understand it welll.
Help
Thx
You could have at least told him he probably wants
ctime He could be forgiven thinking that this is
platform dependent and therefore handled in SDL.
-andrew!
— nbs wrote:> On Mon, May 06, 2002 at 04:03:39PM +0200, Olivier Caignart wrote:
Hi… i would like to know how i can get the time
and day.
I have to make some files named “time_day”.txt
I looked in the time.h in sdl but i didn’t
understand it welll.
Help
ThxThis isn’t an SDL question. Track down the C
Programming FAQ (it’s both
in book form, and online), and I believe you’ll find
the answer.Good luck!
-bill!
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
Sorry, I was rushing off to a doctor’s appointment! :^P
Anyway, the C FAQ is really useful.
-bill!On Mon, May 06, 2002 at 09:54:01AM -0700, Andrew Ford wrote:
You could have at least told him he probably wants
ctime He could be forgiven thinking that this is
platform dependent and therefore handled in SDL.
—end quoted text—
Take a look at the manpages of the functions:
time_t time(time_t *t);
struct tm *gmtime(const time_t *timep);
struct tm *localtime(const time_t *timep);
Making:
time_t t;
struct tm *tm;
time (&t);
tm = localtime (&t);
you will have at tm structure:
struct tm {
int tm_sec; /* seconds /
int tm_min; / minutes /
int tm_hour; / hours /
int tm_mday; / day of the month /
int tm_mon; / month /
int tm_year; / year /
int tm_wday; / day of the week /
int tm_yday; / day in the year /
int tm_isdst; / daylight saving time */
};
and then you just choose what you want…
[]'sOn Mon, May 06, 2002 at 04:03:39PM +0200, Olivier Caignart wrote:
Hi… i would like to know how i can get the time and day.
I have to make some files named “time_day”.txt
I looked in the time.h in sdl but i didn’t understand it welll.
Help
Thx
–
Marcelo R Leitner