Freeze after getting time 2x

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Freeze after getting time 2x

Post by Question_dev »

Got a problem.
I want to make a timer, so at the begin of a function i get the current minutes, and i copy it in a string.
Then at the end of the function, i get the minutes and copy them in a string, but then it freezes. .

Can anyone help ?

Code to get time :

pspTime time;
sceRtcGetCurrentClockLocalTime(&time);
sprintf(StartMin, "%d", time.minutes);

. . . (function)


the same code as above but i print it in EndMin and without 'pspTime time;'
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

is char startmin long enough to handle the time integer?
Image
Upgrade your PSP
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Post by Question_dev »

char EndMin[262] = "";
char StartMin[262] = "";
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

Are you sure it freezes when doing sprintf?
Image
Upgrade your PSP
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Post by Question_dev »

I dont know exactly where, but it's in the second time get part
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

try doing some debug.
printf("0");
add a delay of 1 sec here
first function
printf("1");
add a delay of 1 sec here
second function
printf("2");
add a delay of 1 sec here
third function
Image
Upgrade your PSP
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Post by Question_dev »

i know its in the latest time part, because without the latest it works
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Then why don't you post that section of code? Can't help with code we can't see. :)
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Post by Question_dev »

I wrote it in 1th post, but here again (this is only the second time part, so at the end of the function)

sceRtcGetCurrentClockLocalTime(&time);
sprintf(EndMin, "%d", time.minutes);

So this comes after '. . .function'
Maybe the problem is that i call sceRtc. . 2 times ?

Tnx for the help.
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

we really need more code to help you
it looks like there is an overwritten somewhere or it can come from the stack etc etc ...
The problem may be elsewhere and you see it only there ...
--pspZorba--
NO to K1.5 !
Question_dev
Posts: 88
Joined: Fri Aug 24, 2007 8:23 pm

Post by Question_dev »

Solved :)
Found a strange bugat end of function.

Tnx anyway !
Cu
Post Reply