d5d7871c9ce692f443b5a1f64194b4abe889f6b8 galt Mon Mar 7 22:21:10 2011 -0800 fixing processing of last-modified header in udc; also setting the original time on the finished file in paraFetch (net.c); new helper function in common.c handles conversion to UTC time diff --git src/inc/common.h src/inc/common.h index 66316c9..aad100a 100644 --- src/inc/common.h +++ src/inc/common.h @@ -1354,26 +1354,33 @@ // It is sometimes useful to distinguish between 3 "boolean" states: TRUE, FALSE and UNKNOWN enum enumBool { beUnknown=0, // Not yet set ebYes=1, // already set to TRUE ebNo=-1 // already set to FALSE }; #define SET_TO_YES(ebool) { (ebool) = ebYes; } #define SET_TO_NO(ebool) { (ebool) = ebNo; } #define IS_YES(ebool) ((ebool) == ebYes) #define IS_NO(ebool) ((ebool) == ebNo) #define IS_KNOWN(ebool) (IS_YES(ebool) || IS_NO(ebool)) #define IS_TRUE IS_YES #define IS_FALSE IS_NO +time_t mktimeFromUtc (struct tm *t); +/* Return time_t for tm in UTC (GMT) + * Useful for stuff like converting to time_t the + * last-modified HTTP response header + * which is always GMT. Returns -1 on failure of mktime */ + + time_t dateToSeconds(const char *date,const char*format); // Convert a string date to time_t boolean dateIsOld(const char *date,const char*format); // Is this string date older than now? char *dateAddTo(char *date,char *format,int addYears,int addMonths,int addDays); /* Add years,months,days to a formatted date and returns the new date as a cloned string * format is a strptime/strftime format: %F = yyyy-mm-dd */ #endif /* COMMON_H */