-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.hpp
46 lines (38 loc) · 804 Bytes
/
utils.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <ctime>
#include <cstring>
void printCurrentTime()
{
// Declaring argument for time()
time_t tt;
// Declaring variable to store return value of
// localtime()
struct tm * ti;
// Applying time()
time (&tt);
// Using localtime()
ti = localtime(&tt);
char *str_time = asctime(ti);
str_time[strlen(str_time) - 1] = 0;
std::cout << str_time << " | ";
}
char *getCurrentTime()
{
// Declaring argument for time()
time_t tt;
// Declaring variable to store return value of
// localtime()
struct tm * ti;
// Applying time()
time (&tt);
// Using localtime()
ti = localtime(&tt);
char *str_time = asctime(ti);
str_time[strlen(str_time) - 1] = 0;
return str_time;
}
void debugLog(auto msg)
{
std::cout << "\033[0;33m" << msg
<< "\033[0m" << std::endl;
}