summaryrefslogtreecommitdiffstats
path: root/zpu/sw/startup/time.c
blob: 767b62fa65ae0cb46fd6399038c946e3d9b0c4af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <_ansi.h>
#include <sys/types.h>
#include <sys/stat.h>

extern long long _readCycles();


extern volatile int *MHZ;

long long _readMicroseconds()
{
	int Hz;
	long long clock;
	Hz=(*MHZ&0xff);
	clock=_readCycles();
	return clock/(long long)Hz;
}




time_t
time (time_t *tloc)
{
	time_t t;
	t=(time_t)(_readMicroseconds()/(long long )1000000);
	if (tloc!=NULL)
	{
		*tloc=t;
	}
	return t;
}
OpenPOWER on IntegriCloud