-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added providers interface and initial implementation
Added providers interface and initial implementation that retrieves date and time. Added debug console based on ncurses.
- Loading branch information
1 parent
c78de9d
commit ce43acc
Showing
7 changed files
with
257 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <cstdlib> | ||
#include <ctime> | ||
#include "providers.hpp" | ||
|
||
Provider::Provider() | ||
{ | ||
} | ||
|
||
Provider::~Provider() | ||
{ | ||
} | ||
|
||
string Provider::getIp() | ||
{ | ||
return "172.16.0.1"; | ||
} | ||
|
||
struct tm *getLocaltime() | ||
{ | ||
time_t rawtime; | ||
time(&rawtime); | ||
return localtime(&rawtime); | ||
} | ||
|
||
string Provider::getTime() | ||
{ | ||
tm *timeinfo; | ||
timeinfo = getLocaltime(); | ||
char buffer[32]; | ||
strftime(buffer, sizeof(buffer), "%T", timeinfo); | ||
string s(buffer); | ||
return s; | ||
} | ||
|
||
string Provider::getDate() | ||
{ | ||
tm *timeinfo; | ||
timeinfo = getLocaltime(); | ||
char buffer[32]; | ||
strftime(buffer, sizeof(buffer), "%F", timeinfo); | ||
string s(buffer); | ||
return s; | ||
} | ||
|
||
string Provider::getDateTime() | ||
{ | ||
tm *timeinfo; | ||
timeinfo = getLocaltime(); | ||
char buffer[32]; | ||
strftime(buffer, sizeof(buffer), "%a %b %e %R", timeinfo); | ||
string s(buffer); | ||
return s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <string> | ||
|
||
using namespace std; | ||
|
||
class Provider | ||
{ | ||
public: | ||
Provider(); | ||
~Provider(); | ||
|
||
static string getIp(); | ||
static string getTime(); | ||
static string getDate(); | ||
static string getDateTime(); | ||
}; |
Oops, something went wrong.