1119998Sgad/*- 2119998Sgad * ------+---------+---------+---------+---------+---------+---------+---------* 3119998Sgad * Copyright (c) 2003 - Garance Alistair Drosehn <gad@FreeBSD.org>. 4119998Sgad * All rights reserved. 5119998Sgad * 6119998Sgad * Redistribution and use in source and binary forms, with or without 7119998Sgad * modification, are permitted provided that the following conditions 8119998Sgad * are met: 9119998Sgad * 1. Redistributions of source code must retain the above copyright 10119998Sgad * notice, this list of conditions and the following disclaimer. 11119998Sgad * 2. Redistributions in binary form must reproduce the above copyright 12119998Sgad * notice, this list of conditions and the following disclaimer in the 13119998Sgad * documentation and/or other materials provided with the distribution. 14119998Sgad * 15119998Sgad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16119998Sgad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17119998Sgad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18119998Sgad * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19119998Sgad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20119998Sgad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21119998Sgad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22119998Sgad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23119998Sgad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24119998Sgad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25119998Sgad * SUCH DAMAGE. 26119998Sgad * 27119998Sgad * The views and conclusions contained in the software and documentation 28119998Sgad * are those of the authors and should not be interpreted as representing 29119998Sgad * official policies, either expressed or implied, of the FreeBSD Project. 30119998Sgad * 31119998Sgad * ------+---------+---------+---------+---------+---------+---------+---------* 32119998Sgad * $FreeBSD$ 33119998Sgad * ------+---------+---------+---------+---------+---------+---------+---------* 34119998Sgad */ 35119998Sgad 36119998Sgad#include <sys/cdefs.h> 37119998Sgad#include <time.h> 38119998Sgad 39120361Sgad#define PTM_PARSE_ISO8601 0x0001 /* Parse ISO-standard format */ 40120361Sgad#define PTM_PARSE_DWM 0x0002 /* Parse Day-Week-Month format */ 41120361Sgad#define PTM_PARSE_MATCHDOM 0x0004 /* If the user specifies a day-of-month, 42120361Sgad * then the result should be a month 43120361Sgad * which actually has that day. Eg: 44120361Sgad * the user requests "day 31" when 45120361Sgad * the present month is February. */ 46120361Sgad 47120361Sgadstruct ptime_data; 48120361Sgad 49120361Sgad/* Some global variables from newsyslog.c which might be of interest */ 50120361Sgadextern int dbg_at_times; /* cmdline debugging option */ 51119998Sgadextern int noaction; /* command-line option */ 52119998Sgadextern int verbose; /* command-line option */ 53120361Sgadextern struct ptime_data *dbg_timenow; 54119998Sgad 55119998Sgad__BEGIN_DECLS 56120361Sgadstruct ptime_data *ptime_init(const struct ptime_data *_optsrc); 57120361Sgadint ptime_adjust4dst(struct ptime_data *_ptime, const struct 58120361Sgad ptime_data *_dstsrc); 59120361Sgadint ptime_free(struct ptime_data *_ptime); 60120361Sgadint ptime_relparse(struct ptime_data *_ptime, int _parseopts, 61120361Sgad time_t _basetime, const char *_str); 62120361Sgadconst char *ptimeget_ctime(const struct ptime_data *_ptime); 63120361Sgaddouble ptimeget_diff(const struct ptime_data *_minuend, 64120361Sgad const struct ptime_data *_subtrahend); 65120361Sgadtime_t ptimeget_secs(const struct ptime_data *_ptime); 66120361Sgadint ptimeset_nxtime(struct ptime_data *_ptime); 67120361Sgadint ptimeset_time(struct ptime_data *_ptime, time_t _secs); 68119998Sgad__END_DECLS 69