-
Notifications
You must be signed in to change notification settings - Fork 104
/
bogotime.h
70 lines (56 loc) · 2.03 KB
/
bogotime.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Cherokee
*
* Authors:
* Alvaro Lopez Ortega <alvaro@alobbs.com>
*
* Copyright (C) 2001-2010 Alvaro Lopez Ortega
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef CHEROKEE_BOGOTIME_H
#define CHEROKEE_BOGOTIME_H
#include <cherokee/common.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#else
# include <time.h>
#endif
#include <cherokee/buffer.h>
typedef unsigned long long cherokee_msec_t;
typedef void (*bogotime_callback_t) (void *param);
/* Global bogonow variables
*/
/* Thread safe */
extern struct timeval cherokee_bogonow_tv;
extern volatile cherokee_msec_t cherokee_bogonow_msec;
extern volatile time_t cherokee_bogonow_now;
extern long cherokee_bogonow_tzloc;
/* Thread unsafe */
extern struct tm cherokee_bogonow_tmloc;
extern struct tm cherokee_bogonow_tmgmt;
extern cherokee_buffer_t cherokee_bogonow_strgmt;
/* Functions
*/
ret_t cherokee_bogotime_init (void);
ret_t cherokee_bogotime_free (void);
ret_t cherokee_bogotime_update (void);
ret_t cherokee_bogotime_try_update (void);
/* Multi-threading */
void cherokee_bogotime_lock_read (void);
void cherokee_bogotime_release (void);
/* Callbacks */
ret_t cherokee_bogotime_add_callback (bogotime_callback_t func, void *param, time_t elapse);
#endif /* CHEROKEE_BOGOTIME_H */