Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
md_time.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef mod_md_md_time_h
18 #define mod_md_md_time_h
19 
20 #include <stdio.h>
21 
22 #define MD_SECS_PER_HOUR (60*60)
23 #define MD_SECS_PER_DAY (24*MD_SECS_PER_HOUR)
24 
26 
30 };
31 
33 
34 int md_timeperiod_contains(const md_timeperiod_t *period, apr_time_t time);
36 int md_timeperiod_has_ended(const md_timeperiod_t *period, apr_time_t time);
38 
39 char *md_timeperiod_print(apr_pool_t *p, const md_timeperiod_t *period);
40 
44 const char *md_duration_print(apr_pool_t *p, apr_interval_time_t duration);
45 const char *md_duration_roughly(apr_pool_t *p, apr_interval_time_t duration);
46 
51 apr_status_t md_duration_parse(apr_interval_time_t *ptimeout, const char *value,
52  const char *def_unit);
53 const char *md_duration_format(apr_pool_t *p, apr_interval_time_t duration);
54 
55 typedef struct {
56  apr_interval_time_t norm; /* if > 0, normalized base length */
57  apr_interval_time_t len; /* length of the timespan */
59 
62 
63 int md_timeslice_eq(const md_timeslice_t *ts1, const md_timeslice_t *ts2);
64 
65 const char *md_timeslice_parse(md_timeslice_t **pts, apr_pool_t *p,
66  const char *val, apr_interval_time_t defnorm);
67 const char *md_timeslice_format(const md_timeslice_t *ts, apr_pool_t *p);
68 
70  const md_timeslice_t *ts);
71 
72 #endif /* md_util_h */
char * md_timeperiod_print(apr_pool_t *p, const md_timeperiod_t *period)
apr_interval_time_t len
Definition: md_time.h:57
apr_time_t end
Definition: md_time.h:29
const char * md_duration_format(apr_pool_t *p, apr_interval_time_t duration)
const char * md_timeslice_parse(md_timeslice_t **pts, apr_pool_t *p, const char *val, apr_interval_time_t defnorm)
apr_interval_time_t norm
Definition: md_time.h:56
apr_interval_time_t md_timeperiod_remaining(const md_timeperiod_t *period, apr_time_t time)
md_timeperiod_t md_timeperiod_slice_before_end(const md_timeperiod_t *period, const md_timeslice_t *ts)
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
apr_int64_t apr_time_t
Definition: apr_time.h:45
apr_time_t start
Definition: md_time.h:28
int md_timeperiod_contains(const md_timeperiod_t *period, apr_time_t time)
apr_status_t md_duration_parse(apr_interval_time_t *ptimeout, const char *value, const char *def_unit)
apr_time_t md_timeperiod_length(const md_timeperiod_t *period)
int md_timeperiod_has_ended(const md_timeperiod_t *period, apr_time_t time)
const char * md_timeslice_format(const md_timeslice_t *ts, apr_pool_t *p)
Definition: md_time.h:55
apr_pool_t * p
const char * md_duration_print(apr_pool_t *p, apr_interval_time_t duration)
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: md_time.h:27
int apr_status_t
Definition: apr_errno.h:44
const char * md_duration_roughly(apr_pool_t *p, apr_interval_time_t duration)
int md_timeperiod_has_started(const md_timeperiod_t *period, apr_time_t time)
int md_timeslice_eq(const md_timeslice_t *ts1, const md_timeslice_t *ts2)
apr_status_t md_timeslice_create(md_timeslice_t **pts, apr_pool_t *p, apr_interval_time_t norm, apr_interval_time_t len)