Skip to content

Commit 82e0a36

Browse files
author
Amanda Butler
authored
Merge pull request #344 from deepikabhavnani/rtc_time
RTC and time API pages updated
2 parents 14eb75a + 894f89b commit 82e0a36

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

docs/reference/api/platform/Rtc.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
## Rtc
1+
## RTC
2+
3+
The RTC (Real-Time Clock) class provides mechanisms to set the current time of the hardware RTC with `set_time` API. The time is set as an offset measured in seconds from the time epoch (Unix Epoch - January 1, 1970).
4+
5+
You can use the `attach_rtc` API to hook external RTC for using C time functions. It provides you with `init()`, `read()`, `write()` and `isenabled()` functions to be attached. <a href="/docs/v5.6/reference/time.html" target="_blank">Time</a> provides more information about C `date` and `time` standard library functions.
6+
7+
RTC class APIs are thread safe.
8+
9+
RTC can keep track of time even in a powered down state if the secondary source of power (battery) is connected.
10+
11+
### RTC Time class reference
12+
13+
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/mbed__rtc__time_8h_source.html)
14+
15+
### RTC Time example
16+
17+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/time_HelloWorld/)](https://os.mbed.com/teams/mbed_example/code/time_HelloWorld/file/8593c9813840/main.cpp)

docs/reference/api/platform/Time.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
## Time
22

3-
The C date and time functions are a group of functions in the standard library of the C programming language implementing date and time manipulation operations. They provide support for time acquisition, conversion between date formats and formatted output to strings.
3+
The C `date` and `time` functions are a group of functions in the standard library of the C programming language implementing date and time manipulation operations. They provide support for time acquisition, conversion between date formats and formatted output to strings.
44

5-
### Time hello, world
5+
You can convert time to a human-readable format using `ctime`, `localtime`, `strftime` and other C standard functions.
6+
7+
You cannot use `mktime` and `localtime` C standard library functions in an interrupt handler with the GCC toolchain. We have added dedicated routines `_rtc_mktime` and `_rtc_localtime`, which are optimized and faster then C standard library functions, to overcome this issue.
8+
9+
### RTC Time class reference
10+
11+
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/mbed__mktime_8h_source.html)
12+
13+
### Time example
614

715
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/time_HelloWorld/)](https://os.mbed.com/teams/mbed_example/code/time_HelloWorld/file/8593c9813840/main.cpp)
816

0 commit comments

Comments
 (0)