1*76404edcSAsim Jamshed /* tdate_parse.h - parse string dates into internal form, stripped-down version 2*76404edcSAsim Jamshed ** 3*76404edcSAsim Jamshed ** Copyright (C) 1995 by Jef Poskanzer <[email protected]>. All rights reserved. 4*76404edcSAsim Jamshed ** 5*76404edcSAsim Jamshed ** Redistribution and use in source and binary forms, with or without 6*76404edcSAsim Jamshed ** modification, are permitted provided that the following conditions 7*76404edcSAsim Jamshed ** are met: 8*76404edcSAsim Jamshed ** 1. Redistributions of source code must retain the above copyright 9*76404edcSAsim Jamshed ** notice, this list of conditions and the following disclaimer. 10*76404edcSAsim Jamshed ** 2. Redistributions in binary form must reproduce the above copyright 11*76404edcSAsim Jamshed ** notice, this list of conditions and the following disclaimer in the 12*76404edcSAsim Jamshed ** documentation and/or other materials provided with the distribution. 13*76404edcSAsim Jamshed ** 14*76404edcSAsim Jamshed ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*76404edcSAsim Jamshed ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*76404edcSAsim Jamshed ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*76404edcSAsim Jamshed ** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*76404edcSAsim Jamshed ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*76404edcSAsim Jamshed ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*76404edcSAsim Jamshed ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*76404edcSAsim Jamshed ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*76404edcSAsim Jamshed ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*76404edcSAsim Jamshed ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*76404edcSAsim Jamshed ** SUCH DAMAGE. 25*76404edcSAsim Jamshed */ 26*76404edcSAsim Jamshed 27*76404edcSAsim Jamshed #ifndef _TDATE_PARSE_H_ 28*76404edcSAsim Jamshed #define _TDATE_PARSE_H_ 29*76404edcSAsim Jamshed 30*76404edcSAsim Jamshed /* convert a http date string to time_t format */ 31*76404edcSAsim Jamshed 32*76404edcSAsim Jamshed #ifdef __cplusplus 33*76404edcSAsim Jamshed extern "C" { 34*76404edcSAsim Jamshed # endif 35*76404edcSAsim Jamshed extern time_t httpdate_to_timet( const char* str ); 36*76404edcSAsim Jamshed 37*76404edcSAsim Jamshed 38*76404edcSAsim Jamshed /* 39*76404edcSAsim Jamshed Convert 't' (in time_t format) into a HTTP date string 40*76404edcSAsim Jamshed 41*76404edcSAsim Jamshed <input parameters> 42*76404edcSAsim Jamshed t: input (epoch-based time) 43*76404edcSAsim Jamshed str: output string that holds the HTTP date strinng 44*76404edcSAsim Jamshed strlen: the buffer size of str 45*76404edcSAsim Jamshed <return value> 46*76404edcSAsim Jamshed 0 : in case of successful conversion 47*76404edcSAsim Jamshed -1 : otherwise 48*76404edcSAsim Jamshed by KyoungSoo Park 49*76404edcSAsim Jamshed */ 50*76404edcSAsim Jamshed extern int timet_to_httpdate(time_t t, char* str, int strlen); 51*76404edcSAsim Jamshed 52*76404edcSAsim Jamshed #ifdef __cplusplus 53*76404edcSAsim Jamshed } 54*76404edcSAsim Jamshed # endif 55*76404edcSAsim Jamshed #endif /* _TDATE_PARSE_H_ */ 56