GodMode9i/arm9/source/date.cpp
Pk11 78e9bd9996 A couple derp fixes
- Allocate enough space for byte sizes
- Pass size to 'bytes' count
- Check lang ini not font path for lang reload
- Use 24 hour with 0 instead of space for filename date
2021-11-23 01:44:49 -06:00

40 lines
665 B
C++

#include "date.h"
#include "language.h"
#include <stdio.h>
#include <string>
#include <time.h>
/**
* Get the current time formatted for the top bar.
* @return std::string containing the time.
*/
std::string RetTime()
{
time_t raw;
time(&raw);
const struct tm *Time = localtime(&raw);
char tmp[8];
strftime(tmp, sizeof(tmp), STR_TIME_FORMAT.c_str(), Time);
return tmp;
}
/**
* Get the current time formatted for filenames.
* @return std::string containing the time.
*/
std::string RetTimeForFilename()
{
time_t raw;
time(&raw);
const struct tm *Time = localtime(&raw);
char tmp[8];
strftime(tmp, sizeof(tmp), "%H%M%S", Time);
return tmp;
}