#include "include/Utilities/utilities.h"
#include <ctime>
#include <iomanip>
#include <iostream>
Go to the source code of this file.
std::string getConfigDirectoryPath |
( |
| ) |
|
Todo: do something better to keep track of where we are relative to the config directory
Definition at line 30 of file utilities.cpp.
30 {
return "../config/"; }
std::string getCurrentTimeAndDate |
( |
| ) |
|
Definition at line 18 of file utilities.cpp.
19 auto t = std::time(
nullptr);
20 auto tm = *std::localtime(&t);
21 std::ostringstream ss;
22 ss << std::put_time(&tm,
"%c");
std::string getLcmUrl |
( |
s64 |
ttl | ) |
|
Definition at line 32 of file utilities.cpp.
33 assert(ttl >= 0 && ttl <= 255);
34 return "udpm://239.255.76.67:7667?ttl=" + std::to_string(ttl);
void writeStringToFile |
( |
const std::string & |
fileName, |
|
|
const std::string & |
fileData |
|
) |
| |
Definition at line 7 of file utilities.cpp.
9 FILE* fp = fopen(fileName.c_str(),
"w");
11 printf(
"Failed to fopen %s\n", fileName.c_str());
12 throw std::runtime_error(
"Failed to open file");
14 fprintf(fp,
"%s", fileData.c_str());