Please use mbed-src instead of this library.mbed-src supports GR-PEACH rev.C. mbed-srcライブラリをご利用ください。mbed-srcはGR-PEACH rev.Cに対応しています。

Fork of mbed-src_GR-PEACH_rev_c by GR-PEACH_producer_meeting

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rtc_time.h Source File

rtc_time.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include <time.h>
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 /** Implementation of the C time.h functions
00024  *
00025  * Provides mechanisms to set and read the current time, based
00026  * on the microcontroller Real-Time Clock (RTC), plus some
00027  * standard C manipulation and formating functions.
00028  *
00029  * Example:
00030  * @code
00031  * #include "mbed.h"
00032  *
00033  * int main() {
00034  *     set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
00035  *
00036  *     while(1) {
00037  *         time_t seconds = time(NULL);
00038  *
00039  *         printf("Time as seconds since January 1, 1970 = %d\n", seconds);
00040  *
00041  *         printf("Time as a basic string = %s", ctime(&seconds));
00042  *
00043  *         char buffer[32];
00044  *         strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
00045  *         printf("Time as a custom formatted string = %s", buffer);
00046  *
00047  *         wait(1);
00048  *     }
00049  * }
00050  * @endcode
00051  */
00052 
00053 /** Set the current time
00054  *
00055  * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
00056  * to the time represented by the number of seconds since January 1, 1970
00057  * (the UNIX timestamp).
00058  *
00059  * @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
00060  *
00061  * Example:
00062  * @code
00063  * #include "mbed.h"
00064  *
00065  * int main() {
00066  *     set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
00067  * }
00068  * @endcode
00069  */
00070 void set_time(time_t t);
00071 
00072 #ifdef __cplusplus
00073 }
00074 #endif