A time interface class. This class replicates the normal time functions, but goes a couple of steps further. mbed library 82 and prior has a defective gmtime function. Also, this class enables access to setting the time, and adjusting the accuracy of the RTC.
Dependents: CI-data-logger-server WattEye X10Svr SSDP_Server
Diff: TimeInterface.h
- Revision:
- 8:18489e877b0b
- Parent:
- 6:c79cfe750416
- Child:
- 10:5734dbc2f5cc
- Child:
- 12:a77f1e9e42b3
--- a/TimeInterface.h Thu Nov 26 17:43:26 2015 +0000 +++ b/TimeInterface.h Sat Mar 26 20:36:02 2016 +0000 @@ -71,23 +71,23 @@ /// clock_t clock(void); - /// Gets the current time as a time value, optionally writing it + /// Gets the current time as a UTC time value, optionally writing it /// to a provided buffer. /// - /// This reads the real time clock and returns the current time. + /// This reads the real time clock and returns the current UTC time. /// /// @code /// time_t t_ref1, t_ref2, t_ref3; /// t_ref1 = time(NULL); t_ref2 = t.time(); t.time(&t_ref3); /// @endcode /// - /// @param[inout] timer is an optional pointer to a time_t value that will be written. + /// @param[in,out] timer is an optional pointer to a time_t value that will be written. /// This pointer is ignored when NULL. - /// @returns time value. + /// @returns the UTC time value. /// time_t time(time_t * timer = NULL); - /// Gets the current local time as a time value, optionally writing it + /// Gets the current time as a LOCAL time value, optionally writing it /// to a provided buffer. /// /// This reads the real time clock and returns the current time, adjusted @@ -98,9 +98,9 @@ /// t_ref2 = t.time(); t.timelocal(&t_ref3); /// @endcode /// - /// @param[inout] timer is an optional pointer to a time_t value that will be written. + /// @param[in,out] timer is an optional pointer to a time_t value that will be written. /// This pointer is ignored when NULL. - /// @returns the time value adjusted for the local time zone. + /// @returns the LOCAL time value (UTC adjusted for the LOCAL time zone). /// time_t timelocal(time_t * timer = NULL); @@ -180,9 +180,12 @@ // time zone functions - /// Set the internal RTC (clock) to the time value. The time value - /// should be the UTC time, which then permits gmtime and - /// localtime to be used appropriately. + /// Set the internal RTC (clock) to the time value. + /// + /// The time valueshould be UTC time along with an offset of zero, + /// which then permits gmtime and localtime to be used appropriately. + /// Alternately, the time can be in localtime, and the offset is then + /// used to compute UTC to set the clock. /// /// @param[in] t should be the UTC time value to set the clock to. If the available /// time value is local time, the optional time zone offset can