예제 #1
0
파일: rtc.c 프로젝트: HomerSp/pspautotests
void checkGetTick() {
	pspTime pt;
	u64 ticks;

	printf("Checking sceRtcGetTick\n");

	pt.year = 2012;
	pt.month = 9;
	pt.day = 20;
	pt.hour = 7;
	pt.minutes = 0;
	pt.seconds = 0;
	pt.microseconds = 0;
	printf("Normal: %08x\n", sceRtcGetTick(&pt, &ticks));
	// TODO: Should ticks match?  Depends on timezone?

	pt.year = 0;
	pt.month = 324;
	pt.day = 99;
	pt.hour = -56;
	pt.minutes = 42;
	pt.seconds = 42;
	pt.microseconds = 42000000;
	printf("Bad date: %08x\n", sceRtcGetTick(&pt, &ticks));
}
예제 #2
0
파일: main.c 프로젝트: sum2012/JPCSP-Mirror
void printGetTick()
{
    pspTime psptime;
    u64 tick;

    printf("sceRtcGetTick\n");

    memset(&psptime, 0, sizeof(psptime));
    sceRtcGetTick(&psptime, &tick);
    printf("0 -> %lld\n", tick);

    psptime.year = 1970;
    psptime.month = 1;
    psptime.day = 1;
    psptime.hour = 0;
    psptime.minutes = 0;
    psptime.seconds = 0;
    psptime.microseconds = 0;
    sceRtcGetTick(&psptime, &tick);
    printf("1970-01-01 00:00:00 -> %lld\n", tick);

    psptime.seconds = 1;
    sceRtcGetTick(&psptime, &tick);
    printf("1970-01-01 00:00:01 -> %lld\n", tick);

    psptime.hour = 1;
    psptime.seconds = 0;
    sceRtcGetTick(&psptime, &tick);
    printf("1970-01-01 00:01:00 -> %lld\n", tick);

    psptime.year = 2009;
    psptime.month = 1;
    psptime.day = 2;
    psptime.hour = 3;
    psptime.minutes = 4;
    psptime.seconds = 5;
    psptime.microseconds = 0;
    sceRtcGetTick(&psptime, &tick);
    printf("2009-01-02 03:04:05 -> %lld\n", tick);
}
예제 #3
0
void IndexCategories(Category *head[], const char *path, int location)
{
    SceIoDirent dir;
    SceUID fd;
    u64 mtime;
    char full_path[16];
    int match;

    sce_paf_private_strcpy(full_path, path);
    SET_DEVICENAME(full_path, location);

    if((fd = sceIoDopen(full_path)) < 0) {
        return;
    }

    kprintf("Indexing categories from %s, loc: %i\n", path, location);
    match = 0;
    sce_paf_private_memset(&dir, 0, sizeof(SceIoDirent));

    while(1) {
        if(sceIoDread(fd, &dir) <= 0) {
            kprintf("End of directory list\n");
            sceIoDclose(fd);
            break;
        }
        kprintf("checking [%s], length: %i\n", dir.d_name, sce_paf_private_strlen(dir.d_name));
        if (FIO_S_ISDIR(dir.d_stat.st_mode) && dir.d_name[0] != '.') {
            if(!config.prefix && !is_game_folder(full_path, dir.d_name)) {
                if(has_directories(full_path, dir.d_name) > 0) {
                    match = 1;
                }
            } else if(config.prefix && sce_paf_private_strncmp(dir.d_name, "CAT_", 4) == 0) {
                if(has_directories(full_path, dir.d_name) > 0) {
                    sce_paf_private_strcpy(dir.d_name, dir.d_name + 4);
                    match = 1;
                }
            }
            if(match) {
                match = 0;
                sceRtcGetTick((pspTime *) &dir.d_stat.st_mtime, &mtime);
                kprintf("Adding category: [%s]\n", dir.d_name);
                AddCategory(head, dir.d_name, mtime, location);
            }
        }
    }
}
예제 #4
0
파일: main.c 프로젝트: 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;
}
예제 #5
0
파일: rtc.c 프로젝트: HomerSp/pspautotests
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);
}