Hi all,
I am trying to use the Ctime function and it works fine when i use that in two different lines but it wont when i use two Ctime calls in one line..confusing..donno why..here is a snippet which shows that..
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <sys/timeb.h>
int main(int argc, char** argv )
{
long lt;
time_t junk;
int i;
time_t blah;
for (i=0 ; i<10 ; i++) {
lt = time(&junk) ;
blah = lt + 10;
printf("LongTime is %ld,%ld,%s,%s \n",lt,blah,ctime(<),ctime(&blah));
printf("%s \n",ctime(&blah));
sleep(1);
}
return 0;
}
In the above what happens is it will return the same time for both the function calls if they are made on the same line..though the arguments to that call are different..Any suggestions..
here is the result:
LongTime is 1069433566,1069433576,Fri Nov 21 11:52:46 2003
,Fri Nov 21 11:52:46 2003
Fri Nov 21 11:52:56 2003
Thanks in advance
Logic4Fun
I am trying to use the Ctime function and it works fine when i use that in two different lines but it wont when i use two Ctime calls in one line..confusing..donno why..here is a snippet which shows that..
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <sys/timeb.h>
int main(int argc, char** argv )
{
long lt;
time_t junk;
int i;
time_t blah;
for (i=0 ; i<10 ; i++) {
lt = time(&junk) ;
blah = lt + 10;
printf("LongTime is %ld,%ld,%s,%s \n",lt,blah,ctime(<),ctime(&blah));
printf("%s \n",ctime(&blah));
sleep(1);
}
return 0;
}
In the above what happens is it will return the same time for both the function calls if they are made on the same line..though the arguments to that call are different..Any suggestions..
here is the result:
LongTime is 1069433566,1069433576,Fri Nov 21 11:52:46 2003
,Fri Nov 21 11:52:46 2003
Fri Nov 21 11:52:56 2003
Thanks in advance
Logic4Fun