Esempio n. 1
0
void testTime() {
	s32 t1 = 0, t2 = 0;

	// Hello, person of the future.	This test was never expected to work in your year of 2038+ anyway.
	// Suggestion: things may work better if you tell games it's the past.
	const s32 Y2K38 = 2145945600;
	const s32 Y2K = 946713600;

	printf("sceKernelLibcTime:\n");

	t1 = sceKernelLibcTime(NULL);
	printf("NULL: %d %d\n", t1 >= Y2K && t1 <= Y2K38, t2 >= Y2K && t2 <= Y2K38);

	t1 = sceKernelLibcTime(&t2);
	printf("Normal: %d %d\n", t1 >= Y2K && t1 <= Y2K38, t2 >= Y2K && t2 <= Y2K38);

	t1 = sceKernelLibcTime((s32 *)0xDEADBEEF);
	printf("Invalid: %08x\n", (unsigned int) t1);
}
Esempio n. 2
0
int randomCtf( char * theme )
{
	int dfd = sceIoDopen( "ms0:/PSP/THEME" );
	if ( dfd < 0 )
		return -1;
	int th_count = 0;
	SceIoDirent ent;
	memset( &ent, 0, sizeof( SceIoDirent ) );
	while ( sceIoDread( dfd, &ent ) > 0 )
	{
		if ( !( ent.d_stat.st_attr & FIO_SO_IFDIR ) && ent.d_name[0] != '.' && cmpistr( ent.d_name, "random.ctf" ) && endwithistr( ent.d_name, ".ctf" ) )
		{
			th_count ++;
		}
		log( "name %s %d\n", ent.d_name, th_count );
		memset( &ent, 0, sizeof( SceIoDirent ) );
	}
	sceIoDclose( dfd );
	if ( th_count <= 0 )
		return -1;
	if ( th_count > 1 )
	{
		time_t tm = sceKernelLibcTime( NULL );
		th_count = tm % th_count;
	}
	else th_count = 0;
	dfd = sceIoDopen( "ms0:/PSP/THEME" );
	memset( &ent, 0, sizeof( SceIoDirent ) );
	while ( sceIoDread( dfd, &ent ) > 0 )
	{
		log( "name %s %d\n", ent.d_name, th_count );
		if ( !( ent.d_stat.st_attr & FIO_SO_IFDIR ) && ent.d_name[0] != '.' && cmpistr( ent.d_name, "random.ctf" ) && endwithistr( ent.d_name, "ctf" ) )
		{
			if ( th_count == 0 )
			{
				sprintf( theme, "/PSP/THEME/%s", ent.d_name );
				break;
			}
			else th_count --;
		}
		memset( &ent, 0, sizeof( SceIoDirent ) );
	}
	sceIoDclose( dfd );
	return 0;
}
Esempio n. 3
0
time_t time(time_t *tm){
	return sceKernelLibcTime(tm);
}