From 431a1bf775d468bcd788c3dd716b97cc0fca1f34 Mon Sep 17 00:00:00 2001 From: oharboe Date: Mon, 18 Aug 2008 12:00:34 +0000 Subject: * duplicated crt0.s and some other stuff from libgloss into sw/startup. This makes it easier to tinker w/startup code. --- zpu/sw/startup/time.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 zpu/sw/startup/time.c (limited to 'zpu/sw/startup/time.c') diff --git a/zpu/sw/startup/time.c b/zpu/sw/startup/time.c new file mode 100644 index 0000000..767b62f --- /dev/null +++ b/zpu/sw/startup/time.c @@ -0,0 +1,32 @@ +#include <_ansi.h> +#include +#include + +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; +} -- cgit v1.1