Design Pattern Examples
Overview of object-oriented design patterns
makelocaltime.cpp
Go to the documentation of this file.
1
5
6#include <time.h>
7#include <chrono>
8
9#include "makelocaltime.h"
10
11namespace Helpers
12{
13
15 // makelocaltime function
17 struct tm* makelocaltime(const time_t* time, struct tm* timestruct)
18 {
19 struct tm* returnstruct = nullptr;
20 if (time != nullptr && timestruct != nullptr)
21 {
22 returnstruct = localtime(time);
23 *timestruct = *returnstruct;
24 returnstruct = timestruct;
25 }
26 return returnstruct;
27 }
28
29} // end namespace
Declaration of the makelocaltime() function to convert a time_t to a struct tm containing the local t...
The namespace containing all the "helper" functions in the C++ code.
struct tm * makelocaltime(const time_t *time, struct tm *timestruct)
Convert the given time to local time.