armcc (keil uVision4): how to get time() to return time from the RTC?

1.1k views Asked by At

I'm a developer who's fairly used to working with embedded systems on Linux with free tools. Now I find myself on a project which uses the Keil compiler on Windows (armcc, uVision4... I'm finding the naming of stuff in this area a bit confusing :).

There is a real-time clock on the HW used, but it's always accessed directly via its I2C interface. For various reasons (mostly portability of the code) I'd like to hook it up to the standard time() function.

How would I go about doing this?

1

There are 1 answers

0
werewindle On BEST ANSWER

As described in Keil's libc manual, you should reimplement time() by yourself.

So, your time() implementation should read time from RTC and convert it to Unix Epoch time.