1/* 2 * Copyright 2010 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _B_HTTP_TIME_H_ 6#define _B_HTTP_TIME_H_ 7 8#include <ctime> 9 10#include <String.h> 11 12namespace BPrivate { 13 14enum { 15 B_HTTP_TIME_FORMAT_PARSED = -1, 16 B_HTTP_TIME_FORMAT_RFC1123 = 0, 17 B_HTTP_TIME_FORMAT_PREFERRED = B_HTTP_TIME_FORMAT_RFC1123, 18 B_HTTP_TIME_FORMAT_COOKIE, 19 B_HTTP_TIME_FORMAT_RFC1036, 20 B_HTTP_TIME_FORMAT_ASCTIME 21}; 22 23 24class BHttpTime { 25public: 26 BHttpTime(); 27 BHttpTime(time_t date); 28 BHttpTime(const BString& dateString); 29 30 // Date modification 31 void SetString(const BString& string); 32 void SetDate(time_t date); 33 34 35 // Date conversion 36 time_t Parse(); 37 BString ToString(int8 format = B_HTTP_TIME_FORMAT_PARSED); 38 39private: 40 BString fDateString; 41 time_t fDate; 42 int8 fDateFormat; 43}; 44 45} 46#endif // _B_HTTP_TIME_H_ 47