#include <stdio.h>
#include <time.h>
int main() {
// Get the current time
time_t rawtime;
struct tm *timeinfo;
char buffer[9]; // HH:MM:SS is 8 characters + null terminator
time(&rawtime);
timeinfo = localtime(&rawtime);
// Format the time as "HH:MM:SS"
strftime(buffer, sizeof(buffer), "%H:%M:%S", timeinfo);
printf("Formatted Time: %s\n", buffer);
return 0;
}
/*
run:
Formatted Time: 07:42:18
*/