14 lines
317 B
C
14 lines
317 B
C
#include <time.h>
|
|
#include <stdio.h>
|
|
|
|
// An example of getting the current hour and minute with time.h's `localtime`
|
|
void main () {
|
|
time_t rawtime;
|
|
time(&rawtime);
|
|
|
|
struct tm *current_time;
|
|
current_time = localtime( &rawtime );
|
|
|
|
printf("%d:%d", current_time->tm_hour, current_time->tm_min);
|
|
}
|