Design Pattern Examples
Overview of object-oriented design patterns
datetime.c File Reference

Implementation of the DateTime functions, datetime_to_string() and datetime_now(), to simplify getting the local time as a string. More...

#include "makelocaltime.h"
#include "datetime.h"
Include dependency graph for datetime.c:

Go to the source code of this file.

Functions

const char * datetime_to_string (time_t timestamp)
 Convert the specified time stamp to a string.
 
time_t datetime_now (void)
 Retrieve a time stamp that represents the current time.
 

Detailed Description

Implementation of the DateTime functions, datetime_to_string() and datetime_now(), to simplify getting the local time as a string.

Definition in file datetime.c.

Function Documentation

◆ datetime_now()

time_t datetime_now ( void  )

Retrieve a time stamp that represents the current time.

Returns
A time_t value representing the current time.

Definition at line 27 of file datetime.c.

Referenced by _ConstructTree(), and _GetTimeStamp().

◆ datetime_to_string()

const char * datetime_to_string ( time_t  timestamp)

Convert the specified time stamp to a string.

Parameters
timestampA time_t value representing the time stamp.
Returns
Returns a string representation of the time stamp. The pointer is valid until the next time this function is called.

Definition at line 12 of file datetime.c.

References makelocaltime().

Referenced by _GetTimeStamp(), and Composite_Exercise_FormatEntry().