Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
date_time.h
00001 /** 00002 * @file date_time.h 00003 * @brief Date and time management 00004 * 00005 * @section License 00006 * 00007 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * as published by the Free Software Foundation; either version 2 00012 * of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software Foundation, 00021 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00022 * 00023 * @author Oryx Embedded SARL (www.oryx-embedded.com) 00024 * @version 1.7.6 00025 **/ 00026 00027 #ifndef _DATE_TIME_H 00028 #define _DATE_TIME_H 00029 00030 //Dependencies 00031 #include <time.h> 00032 #include "os_port.h" 00033 00034 00035 /** 00036 * @brief Date and time representation 00037 **/ 00038 00039 typedef struct 00040 { 00041 uint16_t year; 00042 uint8_t month; 00043 uint8_t day; 00044 uint8_t dayOfWeek; 00045 uint8_t hours; 00046 uint8_t minutes; 00047 uint8_t seconds; 00048 uint16_t milliseconds; 00049 } DateTime; 00050 00051 00052 //Date and time management 00053 const char_t *formatSystemTime(systime_t time, char_t *str); 00054 const char_t *formatDate(const DateTime *date, char_t *str); 00055 00056 void getCurrentDate(DateTime *date); 00057 time_t getCurrentUnixTime(void); 00058 00059 void convertUnixTimeToDate(time_t t, DateTime *date); 00060 time_t convertDateToUnixTime(const DateTime *date); 00061 00062 uint8_t computeDayOfWeek(uint16_t y, uint8_t m, uint8_t d); 00063 00064 #endif 00065
Generated on Tue Jul 12 2022 17:10:12 by
1.7.2