Date and time management. More...
Go to the source code of this file.
Functions | |
const char_t * | formatSystemTime (systime_t time, char_t *str) |
Format system time. More... | |
const char_t * | formatDate (const DateTime *date, char_t *str) |
Format date. More... | |
void | getCurrentDate (DateTime *date) |
Get current date and time. More... | |
__weak_func time_t | getCurrentUnixTime (void) |
Get current time. More... | |
void | convertUnixTimeToDate (time_t t, DateTime *date) |
Convert Unix timestamp to date. More... | |
time_t | convertDateToUnixTime (const DateTime *date) |
Convert date to Unix timestamp. More... | |
int_t | compareDateTime (const DateTime *date1, const DateTime *date2) |
Compare dates. More... | |
uint8_t | computeDayOfWeek (uint16_t y, uint8_t m, uint8_t d) |
Calculate day of week. More... | |
Detailed Description
Date and time management.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file date_time.c.
Function Documentation
◆ compareDateTime()
Compare dates.
- Parameters
-
[in] date1 Pointer to the first date [in] date2 Pointer to the second date
- Returns
- Comparison result
Definition at line 304 of file date_time.c.
◆ computeDayOfWeek()
uint8_t computeDayOfWeek | ( | uint16_t | y, |
uint8_t | m, | ||
uint8_t | d | ||
) |
Calculate day of week.
- Parameters
-
[in] y Year [in] m Month of year (in range 1 to 12) [in] d Day of month (in range 1 to 31)
- Returns
- Day of week (in range 1 to 7)
Definition at line 383 of file date_time.c.
◆ convertDateToUnixTime()
time_t convertDateToUnixTime | ( | const DateTime * | date | ) |
Convert date to Unix timestamp.
- Parameters
-
[in] date Pointer to a structure representing the date and time
- Returns
- Unix timestamp
Definition at line 260 of file date_time.c.
◆ convertUnixTimeToDate()
void convertUnixTimeToDate | ( | time_t | t, |
DateTime * | date | ||
) |
Convert Unix timestamp to date.
- Parameters
-
[in] t Unix timestamp [out] date Pointer to a structure representing the date and time
Definition at line 198 of file date_time.c.
◆ formatDate()
Format date.
- Parameters
-
[in] date Pointer to a structure representing the date [out] str NULL-terminated string representing the specified date
- Returns
- Pointer to the formatted string
Definition at line 133 of file date_time.c.
◆ formatSystemTime()
Format system time.
- Parameters
-
[in] time System time [out] str NULL-terminated string representing the specified time
- Returns
- Pointer to the formatted string
Definition at line 77 of file date_time.c.
◆ getCurrentDate()
void getCurrentDate | ( | DateTime * | date | ) |
Get current date and time.
- Parameters
-
[out] date Pointer to a structure representing the date and time
Definition at line 165 of file date_time.c.
◆ getCurrentUnixTime()
__weak_func time_t getCurrentUnixTime | ( | void | ) |