add Sys_TimeOfDay from QWE (HighlandeR)

This commit is contained in:
Bill Currie 2003-11-20 07:00:07 +00:00
parent bb4e9de0db
commit 481c9c4e8d
2 changed files with 29 additions and 0 deletions

View file

@ -48,6 +48,16 @@ enum e_pathtype {
PATHTYPE_RELATIVE_BELOW
};
typedef struct date_s {
int sec;
int min;
int hour;
int day;
int mon;
int year;
char str[128];
} date_t;
int Sys_FileTime (const char *path);
void Sys_mkdir (const char *path);
enum e_pathtype Sys_PathType (const char *path);
@ -65,6 +75,7 @@ void Sys_Quit (void) __attribute__((noreturn));
void Sys_Shutdown (void);
void Sys_RegisterShutdown (void (*func) (void));
double Sys_DoubleTime (void);
void Sys_TimeOfDay(date_t *date);
int Sys_CheckInput (int idle, int net_socket);
const char *Sys_ConsoleInput (void);

View file

@ -325,6 +325,24 @@ Sys_DoubleTime (void)
#endif
}
void
Sys_TimeOfDay (date_t *date)
{
struct tm *newtime;
time_t long_time;
time (&long_time);
newtime = localtime (&long_time);
date->day = newtime->tm_mday;
date->mon = newtime->tm_mon;
date->year = newtime->tm_year + 1900;
date->hour = newtime->tm_hour;
date->min = newtime->tm_min;
date->sec = newtime->tm_sec;
strftime (date->str, 128, "%a %b %d, %H:%M %Y", newtime);
}
void
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
{