Files
redAcore/DateTimeCore.h
Charl Wentzel 8791e25d22 Important update:
- DateTimeCore:
  - Added ReadDateTime() method, combining ReadDate() & ReadTime()
  - Added Read(Time/Date/DateTime)Str() methods for decoding date string
2019-06-16 13:56:26 +02:00

49 lines
2.2 KiB
C

/*
* DateTimeCore.h
*
* Created on: 3 Mar 2017
* Author: wentzelc
*/
#ifndef REDACORE_DATETIMECORE_H_
#define REDACORE_DATETIMECORE_H_
// Standard C/C++ Libraries
#include <cstdlib>
// redA Libraries
/* none */
//---------------------------------------------------------------------------
// Get and set System Date and Time
bool SetTime( unsigned char Hours, unsigned char Minutes, unsigned char Seconds );
bool GetTime( unsigned char &Hours, unsigned char &Minutes, unsigned char &Seconds );
bool SetDate( unsigned char Day, unsigned char Month, unsigned Year );
bool GetDate( unsigned char &Day, unsigned char &Month, unsigned &Year );
char const * GetDateStr( const char * DateSeparator = "/" );
char const * GetTimeStr( const char * TimeSeparator = ":" );
char const * GetDateTimeStr( const char * DateSeparator = "/", const char * TimeSeparator = ":" );
//---------------------------------------------------------------------------
bool ReadTime( const time_t EpochTime, unsigned char &Hours, unsigned char &Minutes, unsigned char &Seconds );
bool ReadDate( const time_t EpochTime, unsigned char &Day, unsigned char &Month, unsigned &Year );
bool ReadDateTime( const time_t EpochTime, unsigned char &Day, unsigned char &Month, unsigned &Year,
unsigned char &Hours, unsigned char &Minutes, unsigned char &Seconds );
bool ReadTimeStr( const char *DateTimeStr, unsigned char &Hours, unsigned char &Minutes, unsigned char &Seconds, bool Maxtime );
bool ReadDateStr( const char *DateTimeStr, unsigned char &Day, unsigned char &Month, unsigned &Year );
bool ReadDateTimeStr( const char *DateTimeStr, unsigned char &Day, unsigned char &Month, unsigned &Year,
unsigned char &Hours, unsigned char &Minutes, unsigned char &Seconds, bool Maxtime );
char const * BuildDateStr( const time_t EpochTime, const char * DateSeparator = "/" );
char const * BuildTimeStr( const time_t EpochTime, const char * TimeSeparator = ":" );
char const * BuildDateTimeStr( const time_t EpochTime, const char * DateSeparator = "/", const char * TimeSeparator = ":" );
//---------------------------------------------------------------------------
#endif /* REDACORE_DATETIMECORE_H_ */