Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

date_time.c File Reference

date_time.c File Reference

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.
const char_t * formatDate (const DateTime *date, char_t *str)
 Format date.
void getCurrentDate (DateTime *date)
 Get current date and time.
time_t getCurrentUnixTime (void)
 Get current time.
void convertUnixTimeToDate (time_t t, DateTime *date)
 Convert Unix timestamp to date.
time_t convertDateToUnixTime (const DateTime *date)
 Convert date to Unix timestamp.
uint8_t computeDayOfWeek (uint16_t y, uint8_t m, uint8_t d)
 Calculate day of week.

Detailed Description

Date and time management.

License

Copyright (C) 2010-2017 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.

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file date_time.c.


Function Documentation

uint8_t computeDayOfWeek ( uint16_t  y,
uint8_t  m,
uint8_t  d 
)

Calculate day of week.

Parameters:
[in]yYear
[in]mMonth of year (in range 1 to 12)
[in]dDay of month (in range 1 to 31)
Returns:
Day of week (in range 1 to 7)

Definition at line 298 of file date_time.c.

time_t convertDateToUnixTime ( const DateTime date )

Convert date to Unix timestamp.

Parameters:
[in]datePointer to a structure representing the date and time
Returns:
Unix timestamp

Definition at line 253 of file date_time.c.

void convertUnixTimeToDate ( time_t  t,
DateTime date 
)

Convert Unix timestamp to date.

Parameters:
[in]tUnix timestamp
[out]datePointer to a structure representing the date and time

Definition at line 194 of file date_time.c.

const char_t* formatDate ( const DateTime date,
char_t *  str 
)

Format date.

Parameters:
[in]datePointer to a structure representing the date
[out]strNULL-terminated string representing the specified date
Returns:
Pointer to the formatted string

Definition at line 130 of file date_time.c.

const char_t* formatSystemTime ( systime_t  time,
char_t *  str 
)

Format system time.

Parameters:
[in]timeSystem time
[out]strNULL-terminated string representing the specified time
Returns:
Pointer to the formatted string

Definition at line 75 of file date_time.c.

void getCurrentDate ( DateTime date )

Get current date and time.

Parameters:
[out]datePointer to a structure representing the date and time

Definition at line 161 of file date_time.c.

time_t getCurrentUnixTime ( void   )

Get current time.

Returns:
Unix timestamp

Definition at line 176 of file date_time.c.