In the program below, with the PSPSDK from SVN repository from yesterday, the displayed clock values look random instead of counting up. The same problem is in Lua Player, where the problem was found. I think in earlier versions of the PSPSDK it worked, but the problem shows only sometimes (looks like it depends on the system time and how long the PSP runs), so I'm not sure. Or is it my fault how I use the clock function?
The fix in 1489 is definitely right for clock, but I think time and gettimeofday should keep __psp_set_errno. You could check the return value of time(123) and gettimeofday(123, 456) to see. I can't test it at the moment.
jimparis wrote:The fix in 1489 is definitely right for clock, but I think time and gettimeofday should keep __psp_set_errno. You could check the return value of time(123) and gettimeofday(123, 456) to see. I can't test it at the moment.
mrbrown wrote:Fixed again :). Thanks for spotting this. I just looked at the manual pages and those funcs should be setting errno on error.
According to the ANSI C standard (at least the ISO/IEC 9899:1999, which I have here) the time() function needs not to set errno, but chapter 7.5 says, that it is implementation dependent: A function can set errno, if it is not documented in the standard otherwise. And looks like for gettimeofday some architectures in newlib sets the variable and some not. And the "Single Unix specification" doesn't define that errno is set, but most Unix manual pages does. But this is hairsplitting, I've never seen a program, which checks errno for gettimeofday, so your patch is ok :-)