Andrew Boyson / clock

Dependents:   oldheating gps motorhome heating

Committer:
andrewboyson
Date:
Thu Mar 21 11:20:40 2019 +0000
Revision:
63:28738aaad2a8
Parent:
57:4daf2e423b27
Child:
73:286a739f7c05
Improved pro rata calculation of clktime

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 46:d3d56cb47940 1 #include <stdint.h>
andrewboyson 46:d3d56cb47940 2 #include <stdbool.h>
andrewboyson 46:d3d56cb47940 3
andrewboyson 57:4daf2e423b27 4 typedef int64_t clktime; //30 bits per second; 1 unit equates to about 1ns or about 1ppb
andrewboyson 57:4daf2e423b27 5
andrewboyson 46:d3d56cb47940 6 extern void ClkTimeSaveSnapshot(void);
andrewboyson 57:4daf2e423b27 7 extern void ClkTimesGetFromSnapshot(clktime* pInt, clktime* pAbs);
andrewboyson 46:d3d56cb47940 8
andrewboyson 57:4daf2e423b27 9 extern clktime ClkTimeGet(void);
andrewboyson 57:4daf2e423b27 10 extern void ClkTimeSet(clktime extClock);
andrewboyson 46:d3d56cb47940 11 extern bool ClkTimeIsSet(void);
andrewboyson 46:d3d56cb47940 12
andrewboyson 46:d3d56cb47940 13 extern void ClkTimeIncrementByOneSecond(uint32_t baseCount);
andrewboyson 46:d3d56cb47940 14
andrewboyson 46:d3d56cb47940 15 #define CLK_TIME_ONE_SECOND_SHIFT 30
andrewboyson 46:d3d56cb47940 16 #define CLK_TIME_ONE_MS_ISH_SHIFT 20
andrewboyson 46:d3d56cb47940 17 #define CLK_TIME_ONE_SECOND (1UL << CLK_TIME_ONE_SECOND_SHIFT)