StuBS
DateTime Struct Reference

Date and Time. More...

#include <object/time.h>

Public Member Functions

 DateTime ()
 Default constructor.
 
 DateTime (uint32_t epoch)
 Construct from a timestamp (Unix epoch time)
 
uint32_t toTimestamp () const
 Convert to Unix epoch time. More...
 

Public Attributes

uint8_t second
 Second (0 - 59)
 
uint8_t minute
 Minute (0 - 59)
 
uint8_t hour
 Hour (0 - 23)
 
uint8_t weekday
 Weekday (1 (Sun) - 7 (Sat))
 
uint8_t day
 Day of Month (1 - 31)
 
uint8_t month
 Month (1 - 12)
 
uint16_t year
 Year (0 (2000) - 99 (2099))
 

Static Public Attributes

static const char *const weekdays [8]
 Name of weekdays. More...
 
static const char *const months [13]
 Name of months. More...
 

Detailed Description

Date and Time.

Note
only Dates between 1 January 2000 and 31 December 2099 are supported

Member Function Documentation

◆ toTimestamp()

uint32_t DateTime::toTimestamp ( ) const

Convert to Unix epoch time.

Returns
Seconds since 1 January 1970

Member Data Documentation

◆ weekdays

const char *const DateTime::weekdays
static
Initial value:
=
{ nullptr, "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }

Name of weekdays.

◆ months

const char *const DateTime::months
static
Initial value:
=
{ nullptr, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" }

Name of months.


The documentation for this struct was generated from the following files: