Time86 Library

The Time86 library is available from 86Duino Coding 102, and provides the API of the Arduino Time library to access the on-board RTC timer.

This library adds timekeeping functionality to 86Duino without external timekeeping hardware. It allows a sketch to get the time and date as: second, minute, hour, day, month and year.

Functional Overview


hour(); // The hour now (0-23)
minute(); // The minute now (0-59)
second(); // The second now (0-59)
day(); // The day now (1-31)
weekday(); // Day of the week, Sunday is day 1
month(); // The month now (1-12)
year(); // The full four digit year: (2009, 2010 etc)

there are also functions to return the hour in 12 hour format:


hourFormat12(); // The hour now in 12 hour format
isAM(); // Returns true if time now is AM
isPM(); // Returns true if time now is PM
now(); // Returns the current time as seconds since Jan 1 1970

The time and date functions can take an optional parameter for the time. This prevents errors if the time rolls over between elements. For example, if a new minute begins between getting the minute and second, the values will be inconsistent. Using the following functions eliminates this problem:


time_t t = now(); // Store the current time in time variable t

hour(t); // Returns the hour for the given time t
minute(t); // Returns the minute for the given time t
second(t); // Returns the second for the given time t
day(t); // The day for the given time t
weekday(t); // Day of the week for the given time t
month(t); // The month for the given time t
year(t); // The year for the given time t

Functions for managing the timer services are:


setTime(t); // Set the system time to the give time t
setTime(hr,min,sec,day,month,yr); // Another way to set the time
adjustTime(adjustment); // Adjust system time by adding
                        // the adjustment value


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.