1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
5 * Copyright (C) 2001-2008, Eduardo Silva P.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Library General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 void mk_clock_log_set_time()
37 if(!log_current_time
.data
)
39 log_current_time
.data
= mk_mem_malloc_z(30);
40 log_current_time
.len
= 28;
43 if ((utime
= time(NULL
)) == -1)
48 log_current_utime
= utime
;
49 strftime(log_current_time
.data
, 30, "[%d/%b/%G %T %z]",
50 (struct tm
*)localtime((time_t *) &utime
));
53 void mk_clock_header_set_time()
59 if(!header_current_time
.data
)
61 header_current_time
.data
= mk_mem_malloc_z(len
);
62 header_current_time
.len
= len
- 1;
66 gmt_tm
= (struct tm
*) gmtime(&date
);
67 n
= strftime(header_current_time
.data
, len
, GMT_DATEFORMAT
, gmt_tm
);
70 void *mk_clock_worker_init(void *args
)
74 mk_clock_log_set_time();
75 mk_clock_header_set_time();