Clean up format_time (Thanks LiquidFenrir)

This commit is contained in:
Alex Taber
2017-08-30 10:06:51 -04:00
committed by GitHub
parent 23d938e0d5
commit 86a1d828c8

View File

@@ -71,29 +71,9 @@ int de_init_services(void)
void format_time(char *time_string) void format_time(char *time_string)
{ {
time_t t = time(NULL); time_t t = time(NULL);
struct tm tm = *localtime(&t); struct tm tm = *localtime(&t);
if (tm.tm_hour < 10) sprintf(time_string, "%s%.2i:%.2i", time_string, tm.tm_hour, tm.tm_min);
{
char temp_string[3] = {0};
sprintf(temp_string, "0%i", tm.tm_hour);
strcat(time_string, temp_string);
} else {
char temp_string[3] = {0};
sprintf(temp_string, "%i", tm.tm_hour);
strcat(time_string, temp_string);
}
strcat(time_string, ":");
if (tm.tm_min < 10)
{
char temp_string[3] = {0};
sprintf(temp_string, "0%i", tm.tm_min);
strcat(time_string, temp_string);
} else {
char temp_string[3] = {0};
sprintf(temp_string, "%i", tm.tm_min);
strcat(time_string, temp_string);
}
} }
Result MCUHWC_GetBatteryLevel(u8 *out) // Code taken from daedreth's fork of lpp-3ds Result MCUHWC_GetBatteryLevel(u8 *out) // Code taken from daedreth's fork of lpp-3ds