mirror of
https://github.com/Hizenberg469/Event-Loop-in-C.git
synced 2026-04-20 01:02:23 +03:00
Project Finished
This commit is contained in:
26
asyncproject/utils.c
Normal file
26
asyncproject/utils.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "utils.h"
|
||||
#include "memory.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char*
|
||||
hrs_min_sec_format(unsigned int seconds) {
|
||||
|
||||
static char time_f[16];
|
||||
unsigned int hrs = 0,
|
||||
min = 0, sec = 0;
|
||||
|
||||
if (seconds > 3600) {
|
||||
min = seconds / 60;
|
||||
sec = seconds % 60;
|
||||
hrs = min / 60;
|
||||
min = min % 60;
|
||||
}
|
||||
else {
|
||||
min = seconds / 60;
|
||||
sec = seconds % 60;
|
||||
}
|
||||
memset(time_f, 0, sizeof(time_f));
|
||||
sprintf(time_f, "%u::%u::%u", hrs, min, sec);
|
||||
return time_f;
|
||||
}
|
||||
Reference in New Issue
Block a user