/*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 Lev Walkin . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id: sf_time.h,v 1.2 2005/05/25 21:55:10 vlm Exp $ */ #ifndef __SF_TIME_H__ #define __SF_TIME_H__ #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /************************/ /*** Time conversions ***/ /************************/ /* * Convert RFC-822/1123, ISO-8601, X.208 * or other types of date/time representation into time_t */ time_t strtotime(char *datestring); /* * This function enables caching local time zone information. * Use this if you want to quickly process huge amount os strtotime(). */ void strtotime_zoneinfo_cache(int on_off); /* * Flags to the timetostr() function: */ enum timetostr_output_flags { TFMT_UNIX = 0x000, /* unix_time format */ TFMT_RFC822 = 0x001, /* Format described in RFC-822/1123 */ TFMT_ISO8601 = 0x002, /* Format described in ISO-8601 */ TFMT_CTIME = 0x003, /* ctime(3) and asctime(3) format */ TFMT_X208 = 0x004, /* Format specified by X.208 */ /* Pure flags to be OR'ed with above */ TFMT_LOCAL = 0x100, /* Construct for local instead of GMT */ TFMT_UF = 0x200, /* User-friendly (detailed) output */ TFMT_OLD822GMT = 0x400, /* Old "...MMM DD YYYY GMT" for HTTP */ }; /* * Convert time_t to string. Flags are defined below. */ char *timetostr(time_t value, int flags); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __SF_TIME_H__ */