repo.or.cz
/
zpu.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add: performance values for Lattice MachXO2
[zpu.git]
/
zpu
/
sw
/
startup
/
time.c
blob
767b62fa65ae0cb46fd6399038c946e3d9b0c4af
1
#include <_ansi.h>
2
#include <sys/types.h>
3
#include <sys/stat.h>
4
5
extern
long long
_readCycles
();
6
7
8
extern volatile
int
*
MHZ
;
9
10
long long
_readMicroseconds
()
11
{
12
int
Hz
;
13
long long
clock
;
14
Hz
=(*
MHZ
&
0xff
);
15
clock
=
_readCycles
();
16
return
clock
/(
long long
)
Hz
;
17
}
18
19
20
21
22
time_t
23
time
(
time_t
*
tloc
)
24
{
25
time_t
t
;
26
t
=(
time_t
)(
_readMicroseconds
()/(
long long
)
1000000
);
27
if
(
tloc
!=
NULL
)
28
{
29
*
tloc
=
t
;
30
}
31
return
t
;
32
}