time.h:
Code: Select all
#ifndef __TIME_H__
#define __TIME_H__
int Time_Draw ();
#endif
Code: Select all
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include "quakedef.h"
int Time_Draw () {
time_t current_time;
struct tm *tm_ptr;
static int current_min = 0;
current_time = time(0);
localtime(¤t_time);
tm_ptr = gmtime(¤t_time);
char *result[24];
int hour = tm_ptr->tm_hour;
int ampm = 0;
current_min = tm_ptr->tm_min;
if(hour == 0)
hour = 12;
else if(hour >= 12) {
ampm = 1;
if(hour >= 13)
hour -= 12;
}
if(ampm == 0)
snprintf (result, 20, "%02d/%02d AM %02d:%02d", tm_ptr->tm_mon+1, tm_ptr->tm_mday, hour, tm_ptr->tm_min);
else
snprintf (result, 20, "%02d/%02d PM %02d:%02d", tm_ptr->tm_mon+1, tm_ptr->tm_mday, hour, tm_ptr->tm_min);
M_Print (200 + ((vid.width - 320)>>1), 8, result);
return 0;
}
Code: Select all
void M_DrawColorBar (int x, int y, int highlight) {
...
}
Code: Select all
#include "time.h"
Code: Select all
M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
Code: Select all
Time_Draw ();