|
@@ -21,10 +21,28 @@ d_char *srv_baseurl = NULL;
|
|
|
int dbglevel = 0;
|
|
|
|
|
|
|
|
|
+d_char *xs_time(char *fmt, int local)
|
|
|
+
|
|
|
+{
|
|
|
+ time_t t = time(NULL);
|
|
|
+ struct tm tm;
|
|
|
+ char tmp[64];
|
|
|
+
|
|
|
+ if (local)
|
|
|
+ localtime_r(&t, &tm);
|
|
|
+ else
|
|
|
+ gmtime_r(&t, &tm);
|
|
|
+
|
|
|
+ strftime(tmp, sizeof(tmp), fmt, &tm);
|
|
|
+
|
|
|
+ return xs_str_new(tmp);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
void srv_log(d_char *str)
|
|
|
|
|
|
{
|
|
|
- char tm[16] = "00:00:00";
|
|
|
+ xs *tm = xs_local_time("%H:%M:%S");
|
|
|
xs *msg = str;
|
|
|
|
|
|
fprintf(stderr, "%s %s\n", tm, msg);
|