1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
5 * Copyright (C) 2001-2010, Eduardo Silva P. <edsiper@gmail.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 void mk_clock_log_set_time()
37 if (!log_current_time
.data
) {
38 log_current_time
.data
= mk_mem_malloc_z(30);
39 log_current_time
.len
= 28;
42 if ((utime
= time(NULL
)) == -1) {
46 log_current_utime
= utime
;
47 strftime(log_current_time
.data
, 30, "[%d/%b/%G %T %z]",
48 (struct tm
*) localtime((time_t *) & utime
));
51 void mk_clock_header_set_time()
57 if (!header_current_time
.data
) {
58 header_current_time
.data
= mk_mem_malloc_z(len
);
59 header_current_time
.len
= len
- 1;
63 gmt_tm
= (struct tm
*) gmtime(&date
);
64 n
= strftime(header_current_time
.data
, len
, GMT_DATEFORMAT
, gmt_tm
);
67 void *mk_clock_worker_init(void *args
)
69 /* Time when monkey was started */
70 monkey_init_time
= time(NULL
);
73 mk_clock_log_set_time();
74 mk_clock_header_set_time();