| View previous topic :: View next topic |
| Author |
Message |
Question_dev
Joined: 24 Aug 2007 Posts: 88
|
Posted: Wed Jun 18, 2008 12:43 am Post subject: Freeze after getting time 2x |
|
|
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;' |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Wed Jun 18, 2008 1:43 am Post subject: |
|
|
is char startmin long enough to handle the time integer? _________________
Upgrade your PSP |
|
| Back to top |
|
 |
Question_dev
Joined: 24 Aug 2007 Posts: 88
|
Posted: Wed Jun 18, 2008 1:48 am Post subject: |
|
|
char EndMin[262] = "";
char StartMin[262] = ""; |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Wed Jun 18, 2008 2:10 am Post subject: |
|
|
Are you sure it freezes when doing sprintf? _________________
Upgrade your PSP |
|
| Back to top |
|
 |
Question_dev
Joined: 24 Aug 2007 Posts: 88
|
Posted: Wed Jun 18, 2008 2:36 am Post subject: |
|
|
| I dont know exactly where, but it's in the second time get part |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Wed Jun 18, 2008 2:41 am Post subject: |
|
|
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 _________________
Upgrade your PSP |
|
| Back to top |
|
 |
Question_dev
Joined: 24 Aug 2007 Posts: 88
|
Posted: Wed Jun 18, 2008 3:38 am Post subject: |
|
|
| i know its in the latest time part, because without the latest it works |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Jun 18, 2008 3:44 am Post subject: |
|
|
| Then why don't you post that section of code? Can't help with code we can't see. :) |
|
| Back to top |
|
 |
Question_dev
Joined: 24 Aug 2007 Posts: 88
|
Posted: Wed Jun 18, 2008 4:03 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
pspZorba
Joined: 22 Sep 2007 Posts: 156 Location: NY
|
Posted: Wed Jun 18, 2008 4:28 am Post subject: |
|
|
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 ! |
|
| Back to top |
|
 |
Question_dev
Joined: 24 Aug 2007 Posts: 88
|
Posted: Thu Jun 19, 2008 5:40 am Post subject: |
|
|
Solved :)
Found a strange bugat end of function.
Tnx anyway !
Cu |
|
| Back to top |
|
 |
|