source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_rtc_time.h@ 374

Last change on this file since 374 was 374, checked in by coas-nagasima, 5 years ago

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.6 KB
Line 
1
2/** \addtogroup platform */
3/** @{*/
4/**
5 * \defgroup platform_rtc_time rtc_time functions
6 * @{
7 */
8/* mbed Microcontroller Library
9 * Copyright (c) 2006-2013 ARM Limited
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 */
23
24#include <time.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/** Implementation of the C time.h functions
31 *
32 * Provides mechanisms to set and read the current time, based
33 * on the microcontroller Real-Time Clock (RTC), plus some
34 * standard C manipulation and formating functions.
35 *
36 * Example:
37 * @code
38 * #include "mbed.h"
39 *
40 * int main() {
41 * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
42 *
43 * while(1) {
44 * time_t seconds = time(NULL);
45 *
46 * printf("Time as seconds since January 1, 1970 = %d\n", seconds);
47 *
48 * printf("Time as a basic string = %s", ctime(&seconds));
49 *
50 * char buffer[32];
51 * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
52 * printf("Time as a custom formatted string = %s", buffer);
53 *
54 * wait(1);
55 * }
56 * }
57 * @endcode
58 */
59
60/** Set the current time
61 *
62 * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
63 * to the time represented by the number of seconds since January 1, 1970
64 * (the UNIX timestamp).
65 *
66 * @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
67 *
68 * @note Synchronization level: Thread safe
69 *
70 * Example:
71 * @code
72 * #include "mbed.h"
73 *
74 * int main() {
75 * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
76 * }
77 * @endcode
78 */
79void set_time(time_t t);
80
81/** Attach an external RTC to be used for the C time functions
82 *
83 * @note Synchronization level: Thread safe
84 *
85 * @param read_rtc pointer to function which returns current UNIX timestamp
86 * @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL
87 * @param init_rtc pointer to funtion which initializes RTC, can be NULL
88 * @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL
89 */
90void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void));
91
92#ifdef __cplusplus
93}
94#endif
95
96/** @}*/
97/** @}*/
Note: See TracBrowser for help on using the repository browser.