提交 350b8622 编写于 作者: P PaulStoffregen

Update readme

上级 22c59471
...@@ -18,7 +18,7 @@ hour(); // the hour now (0-23) ...@@ -18,7 +18,7 @@ hour(); // the hour now (0-23)
minute(); // the minute now (0-59) minute(); // the minute now (0-59)
second(); // the second now (0-59) second(); // the second now (0-59)
day(); // the day now (1-31) day(); // the day now (1-31)
weekday(); // day of the week, Sunday is day 0 weekday(); // day of the week (1-7), Sunday is day 1
month(); // the month now (1-12) month(); // the month now (1-12)
year(); // the full four digit year: (2009, 2010 etc) year(); // the full four digit year: (2009, 2010 etc)
...@@ -44,23 +44,26 @@ following functions eliminates this probglem ...@@ -44,23 +44,26 @@ following functions eliminates this probglem
Functions for managing the timer services are: Functions for managing the timer services are:
setTime(t); // set the system time to the give time t
setTime(hr,min,sec,day,mnth,yr); // alternative to above, yr is 2 or 4 digit yr (2010 or 10 sets year to 2010)
adjustTime(adjustment); // adjust system time by adding the adjustment value
timeStatus(); // indicates if time has been set and recently synchronized setTime(t); // set the system time to the give time t
setTime(hr,min,sec,day,mnth,yr); // alternative to above, yr is 2 or 4 digit yr
// (2010 or 10 sets year to 2010)
adjustTime(adjustment); // adjust system time by adding the adjustment value
timeStatus(); // indicates if time has been set and recently synchronized
// returns one of the following enumerations: // returns one of the following enumerations:
timeNotSet // the time has never been set, the clock started at Jan 1 1970 timeNotSet // the time has never been set, the clock started at Jan 1 1970
timeNeedsSync // the time had been set but a sync attempt did not succeed timeNeedsSync // the time had been set but a sync attempt did not succeed
timeSet // the time is set and is synced timeSet // the time is set and is synced
Time and Date values are not valid if the status is timeNotSet. Otherwise values can be used but Time and Date values are not valid if the status is timeNotSet. Otherwise values can be used but
the returned time may have drifted if the status is timeNeedsSync. the returned time may have drifted if the status is timeNeedsSync.
setSyncProvider(getTimeFunction); // set the external time provider setSyncProvider(getTimeFunction); // set the external time provider
setSyncInterval(interval); // set the number of seconds between re-sync setSyncInterval(interval); // set the number of seconds between re-sync
There are many convenience macros in the time.h file for time constants and conversion of time units. There are many convenience macros in the time.h file for time constants and conversion
of time units.
To use the library, copy the download to the Library directory. To use the library, copy the download to the Library directory.
...@@ -84,7 +87,8 @@ illustrating how the library can be used with various time sources: ...@@ -84,7 +87,8 @@ illustrating how the library can be used with various time sources:
- TimeRTCLog demonstrates how to calculate the difference between times. - TimeRTCLog demonstrates how to calculate the difference between times.
It is a vary simple logger application that monitors events on digtial pins It is a vary simple logger application that monitors events on digtial pins
and prints (to the serial port) the time of an event and the time period since the previous event. and prints (to the serial port) the time of an event and the time period since
the previous event.
- TimeNTP uses the Arduino Ethernet shield to access time using the internet NTP time service. - TimeNTP uses the Arduino Ethernet shield to access time using the internet NTP time service.
The NTP protocol uses UDP and the UdpBytewise library is required, see: The NTP protocol uses UDP and the UdpBytewise library is required, see:
...@@ -124,8 +128,8 @@ All the members of the Arduino tm structure are bytes and the year is offset fro ...@@ -124,8 +128,8 @@ All the members of the Arduino tm structure are bytes and the year is offset fro
Convenience macros provide conversion to and from the Arduino format. Convenience macros provide conversion to and from the Arduino format.
Low level functions to convert between system time and individual time elements are provided: Low level functions to convert between system time and individual time elements are provided:
breakTime( time, &tm); // break time_t into elements stored in tm struct breakTime(time, &tm); // break time_t into elements stored in tm struct
makeTime( &tm); // return time_t from elements stored in tm struct makeTime(&tm); // return time_t from elements stored in tm struct
The DS1307RTC library included in the download provides an example of how a time provider The DS1307RTC library included in the download provides an example of how a time provider
can use the low level functions to interface with the Time library. can use the low level functions to interface with the Time library.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册