How to get Time in seconds??
-
- Posts: 2
- Joined: Sun Feb 25, 2007 3:18 am
How to get Time in seconds??
Sorry for maybe lame question. I'm using Old School library, and i'm newbie at C\C++ programming. And there is so little examples for psp SDK, and i still cannot properly read header files.
PLease help me. I would be very greatfull for function that will return time in sec. Thx!
PLease help me. I would be very greatfull for function that will return time in sec. Thx!
-
- Posts: 2
- Joined: Sun Feb 25, 2007 3:18 am
these posts only create the spiraling effect
you dont know how to get milliseconds now
then you need to know how to view contents of
a directory for a file browser or you might not
know how to sort filenames ...the point is that
this site is not here for rudimentary programming
exercises ...those things are best learnt somewhere
else where we ALL have learnt them ...from books
from online articles, tutorials of all natures ...so before
i will allow this spiraling to happen to you ...go do your
part in your understanding
go do some research :)
start of with the simple stuff and you will know
more questions and not more answers
http://www.cplusplus.com
you dont know how to get milliseconds now
then you need to know how to view contents of
a directory for a file browser or you might not
know how to sort filenames ...the point is that
this site is not here for rudimentary programming
exercises ...those things are best learnt somewhere
else where we ALL have learnt them ...from books
from online articles, tutorials of all natures ...so before
i will allow this spiraling to happen to you ...go do your
part in your understanding
go do some research :)
start of with the simple stuff and you will know
more questions and not more answers
http://www.cplusplus.com
10011011 00101010 11010111 10001001 10111010
I have problem, there is code:
So, the problem is that localtime don't correct time to my local time and tz.tz_minuteswest is equals to 0;
But I know that in psp settings GMT+2.00 and main meny showing me right time.
Of course I can add 2 hours, but it's not beatifully.
Code: Select all
char str_today[128];
time_t now;
tm *today;
time(&now);
today = localtime(&now);
timeval tv;
timezone tz;
sceKernelLibcGettimeofday(&tv, &tz);
pspDebugScreenSetXY(0,0);
strftime(str_today, sizeof(str_today), "%d.%m.%Y %H:%M:%S %c %X", today);
printf("%s\n%s\n", str_today, ctime(&now));
printf("%d %d\n", tz.tz_minuteswest, tz.tz_dsttime);
But I know that in psp settings GMT+2.00 and main meny showing me right time.
Of course I can add 2 hours, but it's not beatifully.
Perhaps when people ask questions like "how do I get the time?" we should just always post this:
http://psp.jim.sh/pspsdk-doc/
http://psp.jim.sh/pspsdk-doc/
Calm down, guys, it was a legit question, even though it's been answered on these forums before.
Cy-4AH, you have to call "tzset()" to set up the timezone in newlib.
It will initialize it automatically using the PSP's timezone settings.
See this post for more details: http://forums.ps2dev.org/viewtopic.php? ... ight=tzset
Cy-4AH, you have to call "tzset()" to set up the timezone in newlib.
It will initialize it automatically using the PSP's timezone settings.
See this post for more details: http://forums.ps2dev.org/viewtopic.php? ... ight=tzset
J.F.Of course I use pspsdk-doc. Do you think that I just imagened functions time and localtime and they magicaly begin work?J.F. wrote:Perhaps when people ask questions like "how do I get the time?" we should just always post this:
http://psp.jim.sh/pspsdk-doc/
If you look in pspsdk-doc at time.h you'll see that there is nothing usefull, only functions prototypes and function tzset not even mentioned Don't believe? . Look http://psp.jim.sh/pspsdk-doc/time_8h.html. So I looked in MSDN and didn't noticed tzset :)
May be you should add to sdk: "Before using localtime call tzset to set your local zone".
Notice I said questions LIKE that one, not that one itself. :)Cy-4AH wrote:J.F.Of course I use pspsdk-doc. Do you think that I just imagened functions time and localtime and they magicaly begin work?J.F. wrote:Perhaps when people ask questions like "how do I get the time?" we should just always post this:
http://psp.jim.sh/pspsdk-doc/
If you look in pspsdk-doc at time.h you'll see that there is nothing usefull, only functions prototypes and function tzset not even mentioned Don't believe? . Look http://psp.jim.sh/pspsdk-doc/time_8h.html. So I looked in MSDN and didn't noticed tzset :)
May be you should add to sdk: "Before using localtime call tzset to set your local zone".
And it's good you use the docs... just be sure to mention that along with the question so that people know you aren't just being lazy. :D