Skip to content

Commit e90fddd

Browse files
author
deepikabhavnani
committed
RTC and time API pages updated
1 parent 28e8a06 commit e90fddd

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-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 `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. [Time](/docs/v5.6/reference/time.html) provides more information about C `date` and `time` standard library functions.
6+
7+
RTC class API's are thread safe.
8+
9+
RTC can keep track of time even in powered down state if 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: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
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+
The C library function `time` is updated to read current RTC time if enabled, else time is set to 0 with `set_time` before reading RTC.
6+
7+
You can covert time to human readable format using `ctime`, `localtime`, `strftime` and other C standard functions.
8+
9+
`mktime` and `localtime` C standard library functions cannot be used in interrupt handler with GCC toolchain. Dedicated routines for `mktime` and `localtime` are added to overcome this issue, which are optimized and faster then C standard library functions.
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+
### Time example
616

717
[![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)
818

0 commit comments

Comments
 (0)