Example #1
0
void checkRtcTickAddMonths()
{
	printf("Checking sceRtcTickAddMonths\n");

	u64 sourceTick = 62135596800000445ULL;
	u64 destTick = 0;
	pspTime pt;

	printf("62135596800000445 adding -2000 months: %08x\n", sceRtcTickAddMonths(&destTick, &sourceTick, -2000));
	printf("source tick %llu\n", sourceTick);
	sceRtcSetTick(&pt, &sourceTick);
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);

	printf("dest tick  %llu\n", destTick);
	sceRtcSetTick(&pt, &destTick);
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);

	sourceTick = 62135596800000445ULL;
	destTick = 0;

	printf("62135596800000445 adding +2000 months: %08x\n", sceRtcTickAddMonths(&destTick, &sourceTick, 2000));
	printf("source tick  %llu\n", sourceTick);
	sceRtcSetTick(&pt, &sourceTick);
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);

	printf("dest tick  %llu\n", destTick);
	sceRtcSetTick(&pt, &destTick);
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);

}
Example #2
0
void printSetTick()
{
    pspTime psptime;
    u64 tick;

    memset(&psptime, 0xee, sizeof(psptime));
    printf("0xee -> %04d-%02d-%02d %02d:%02d:%02d %d\n",
        psptime.year, psptime.month, psptime.day,
        psptime.hour, psptime.minutes, psptime.seconds,
        (unsigned int)psptime.microseconds);

    printf("sceRtcSetTick\n");

    tick = 4901191089332944926LL;
    memset(&psptime, 0, sizeof(psptime));
    sceRtcSetTick(&psptime, &tick);
    printf("%lld -> %04d-%02d-%02d %02d:%02d:%02d %d\n",
        tick,
        psptime.year, psptime.month, psptime.day,
        psptime.hour, psptime.minutes, psptime.seconds,
        (unsigned int)psptime.microseconds);

    tick = 63366462245000000LL;
    memset(&psptime, 0, sizeof(psptime));
    sceRtcSetTick(&psptime, &tick);
    printf("  %lld -> %04d-%02d-%02d %02d:%02d:%02d %d\n",
        tick,
        psptime.year, psptime.month, psptime.day,
        psptime.hour, psptime.minutes, psptime.seconds,
        (unsigned int)psptime.microseconds);
}
Example #3
0
void checkSetTick()
{
	pspTime pt;
	u64 ticks = 835072;

	memset(&pt, 0, sizeof(pt));

	printf("checkSetTick: empty small value: %08x\n", sceRtcSetTick(&pt, &ticks));
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);

	ticks = 62135596800000000ULL;
	memset(&pt, 0, sizeof(pt));
	printf("checkSetTick: empty rtcMagicOffset: %08x\n", sceRtcSetTick(&pt, &ticks));
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);

	pt.year = 2012;
	pt.month = 9;
	pt.day = 20;
	pt.hour = 7;
	pt.minutes = 12;
	pt.seconds = 15;
	pt.microseconds = 500;
	printf("Normal: %08x\n", sceRtcGetTick(&pt, &ticks)); // if this does depend on timezone the next bit might have differnt results
	printf("checkSetTick: 2012, 09, 20, 7, 12, 15, 500: %08x\n", sceRtcSetTick(&pt, &ticks));
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);

	pt.year = 2010;
	pt.month = 9;
	pt.day = 20;
	pt.hour = 7;
	pt.minutes = 12;
	pt.seconds = 15;
	pt.microseconds = 500;
	printf("preset\n");
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);
	printf("checkSetTick: not empty:%08x\n", sceRtcSetTick(&pt, &ticks));
	printf("%d, %d, %d, %d, %d, %d, %d\n", pt.year, pt.month, pt.day, pt.hour, pt.minutes, pt.seconds, pt.microseconds);
}
Example #4
0
File: main.c Project: yne/js-psp
int get(u64 tick,int elem,int local){//1=year ... 7:ms
	pspTime t;
	if(local)sceRtcTickAddMinutes(&tick,&tick,timeZone);
	sceRtcSetTick(&t,&tick);
	switch(elem){
		case 1 :return t.year;
		case 2 :return t.month;
		case 3 :return t.day;
		case 4 :return sceRtcGetDayOfWeek(t.year,t.month,t.day);
		case 5 :return t.hour;
		case 6 :return t.minutes;
		case 7 :return t.seconds;
		case 8 :return t.microseconds/1000;
		default:return 0;
	}
	return 0;
}
Example #5
0
File: main.c Project: yne/js-psp
u64 set(u64 tick,int elem,int value,int local){//1=year ... 7:ms
	pspTime t;
	if(local)sceRtcTickAddMinutes(&tick,&tick,timeZone);//localize tick
	sceRtcSetTick(&t,&tick);
	switch(elem){
		case 1 :t.year=value;break;
		case 2 :t.month=value;break;
		case 3 :t.day=value;break;
		case 5 :t.hour=value;break;
		case 6 :t.minutes=value;break;
		case 7 :t.seconds=value;break;
		case 8 :t.microseconds=value*1000;break;
		default:return 0;
	}
	sceRtcGetTick(&t,&tick);
	if(local)tick-= timeZone*60*1000*1000;//go back to UTC
	return tick;
}
Example #6
0
void PspSpeedTests::tickSpeed() {
	uint32 ticksPerSecond = sceRtcGetTickResolution();
	PSP_INFO_PRINT("ticksPerSecond[%d]\n", ticksPerSecond);

	uint32 currentTicks1[2];
	uint32 currentTicks2[2];

	sceRtcGetCurrentTick((u64 *)currentTicks1);
	sceRtcGetCurrentTick((u64 *)currentTicks2);
	PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks1[0], currentTicks1[1], currentTicks1[0], currentTicks1[1]);
	PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks2[0], currentTicks2[1], currentTicks2[0], currentTicks2[1]);

	pspTime time;
	sceRtcSetTick(&time, (u64 *)currentTicks2);
	PSP_INFO_PRINT("current tick in time, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time.year, time.month, time.day, time.hour, time.minutes, time.seconds, time.microseconds);

	pspTime time1;
	pspTime time2;
	sceRtcGetCurrentClockLocalTime(&time1);
	sceRtcGetCurrentClockLocalTime(&time2);
	PSP_INFO_PRINT("time1, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time1.year, time1.month, time1.day, time1.hour, time1.minutes, time1.seconds, time1.microseconds);
	PSP_INFO_PRINT("time2, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time2.year, time2.month, time2.day, time2.hour, time2.minutes, time2.seconds, time2.microseconds);
}