Epoch Time?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Yeldarb
Posts: 2
Joined: Wed Jul 20, 2005 4:46 am

Epoch Time?

Post by Yeldarb »

Hey, I've looked around and searched a bit, but haven't been able to find any answers (found a few similar questions, but they didn't really post their solutions). Is there a (preferably simple) way to get the epoch time? I'm trying to implement a simple timer into a program, but can't find much relevant to this.

I've tried using the datatype time_t, but I can't figure out how to convert that to an integer... It's probably a very simple question -- sorry about that (I'm new to C).
Yeldarb
Posts: 2
Joined: Wed Jul 20, 2005 4:46 am

Post by Yeldarb »

Arg. Don't you hate it when you post stupid questions and then figure it out right after you post?

Here's what worked:

Code: Select all

time_t startTime = sceKernelLibcTime(NULL);
time_t curTime;
int i=0;
while&#40;i < 10000&#41; &#123;
	i++;
	curTime = sceKernelLibcTime&#40;NULL&#41;;
	printf&#40;"Time &#40;%d&#41;&#58; %ld\n", i, curTime - startTime&#41;;
&#125;
The problem was apparently that I was using the wrong modifiers in my printf statement :-\
Post Reply