Andrew Boyson
/
iot
Backing up an unused program in case of future need
time.cpp
- Committer:
- andrewboyson
- Date:
- 2016-04-13
- Revision:
- 0:09f915e6f9f6
- Child:
- 2:06fa34661f19
File content as of revision 0:09f915e6f9f6:
#include "mbed.h" #define ONE_MILLION 1000000 Ticker ticker; uint64_t unixTime16ths; static void tick(void) { unixTime16ths++; } void TimeInit() { ticker.attach_us(&tick, ONE_MILLION >> 4); } void TimeSet(uint32_t t) { unixTime16ths = (uint64_t)t << 4; } uint32_t TimeGet() { return unixTime16ths >> 4; } void TimeSet16ths(uint64_t t) { unixTime16ths = t; } uint64_t TimeGet16ths() { return unixTime16ths; }