add: performance values for Lattice MachXO2
[zpu.git] / zpu / sw / startup / time.c
blob767b62fa65ae0cb46fd6399038c946e3d9b0c4af
1 #include <_ansi.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
5 extern long long _readCycles();
8 extern volatile int *MHZ;
10 long long _readMicroseconds()
12 int Hz;
13 long long clock;
14 Hz=(*MHZ&0xff);
15 clock=_readCycles();
16 return clock/(long long)Hz;
22 time_t
23 time (time_t *tloc)
25 time_t t;
26 t=(time_t)(_readMicroseconds()/(long long )1000000);
27 if (tloc!=NULL)
29 *tloc=t;
31 return t;