ctime() on ut_tv.tv_sec of utmp structure?
I'm using ubuntu9.10 (x86_64) and have some code,
Code:
void show_utmp(struct utmp* ent) guest tty7 Sat Jul 31 04:37:29 2010 Thu Feb 16 20:35:21 28472119 why? and in /usr/include/bits/utmp.h, i found sippet: Code:
#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 |
somebody help me...
|
can you make a compilable example?
|
sorry for late reply.
the following is the example. Code:
#include <stdio.h> |
ctime() creates a printable date-time string which includes a newline character.
Code:
The ctime() function adjusts the time value for the current time zone, in the same |
When compiling with -Wall, your code gives warnings
Code:
fortyfourgalena@desktop1:~/progs/c/lq823035$ gcc -Wall lq823035.c -o lq823035 And this is the output Code:
fortyfourgalena@desktop1:~/progs/c/lq823035$ ./lq823035 |
the following is my output:
plz put you uname output...I think the problem only appears in 64-bit OS. for ctime() expects a pointer to 64bit, but i give it a pointer to 32bit, so the following 32bit is included in, so produce the wrong result. guest@bequiet:~/workspaceCpp/PGMPractise$ uname -a Code:
Linux bequiet 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 x86_64 GNU/Linux Code:
cc iwho.c -o iwho Code:
guest tty7 Mon Aug 2 22:52:51 2010 |
I indeed use a 32-bit version of Ubuntu 8.04
Code:
fortyfourgalena@desktop1:~$ uname -a |
so, how to write portable program...?
|
All times are GMT -5. The time now is 04:05 AM. |