Curie Time Library

This library allows an Arduino/Genuino 101 control and use the internal RTC (Real Time Clock).

Overview

This library is included in the Arc32 core. This core can be installed through the Arduino IDEs , where the package is named "Intel Curie Boards".

This library allows an Arduino/Genuino 101 control and use the internal RTC (Real Time Clock). A real-time clock is a clock that keeps track of the current time and that can be used in order to program actions at a certain time. Most RTCs use a crystal oscillator whose frequency is 32.768 kHz (same frequency used in quartz clocks and watches). Namely this the frequency equal to 2^15 cycles per second and so is a convenient rate to use with simple binary counter circuits. Furthermore the RTC can continue to operate in any sleep mode, so it can be used to wake up the device from sleep modes in a programmed way. Every time the board is powered, the RTC is reset and starts from a standard date. To keep the time and the RTC running it is necessary to keep the board powered.

To use this library

1#include <CurieTime.h>

Examples

Functions


now()

Description

Returns the number of seconds since Jan 1 1970.

Syntax

1unsigned long now = now()

Returns

The number of seconds since Jan 1 1970.


year()

Description

Set or read the RTC year value.

Syntax

1year(unsigned long year)
2
3unsigned long year = year();

Parameters

year: the year value to be set.

Returns

The current year value.


month()

Description

Set or read the RTC month value.

Syntax

1month(unsigned long month)
2
3unsigned long month = month();

Parameters

month: the month value to be set.

Returns

The current month value.


day()

Description

Set or read the RTC day value.

Syntax

1day(unsigned long day)
2
3unsigned long day = day();

Parameters

day: the day value to be set.

Returns

The current day value.


hour()

Description

Set or read the RTC hour value.

Syntax

1hour(unsigned long hour)
2
3unsigned long hour = hour();

Parameters

hour: the hour value to be set.

Returns

The current hour value.


minute()

Description

Set or read the RTC minute value.

Syntax

1minute(unsigned long minute)
2
3unsigned long minute = minute();

Parameters

minute: the minute value to be set.

Returns

The current minute value.


second()

Description

Set or read the RTC second value.

Syntax

1second(unsigned long second)
2
3unsigned long second = second();

Parameters

second: the second value to be set.

Returns

The current second value.


setTime()

Description

Set hour, minute, second, day, month and year of the RTC

Syntax

1void setTime(int hour, int minute, int second, int day, int month, int year)
2
3void setTime(unsigned long t)

Parameters

hour: the hour value to be set.

minute: the minute value to be set.

second: the second value to be set.

day: the day value to be set.

minute: the minute value to be set.

year: the year value to be set.

t: the current number of seconds since Jan 1 1970

Contribute to Arduino

Join the community and suggest improvements to this article via GitHub. Make sure to read out contribution policy before making your pull request.

Missing something?

Check out our store and get what you need to follow this tutorial.