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 <DateTime.h> 11#include <String.h> 12 13namespace BPrivate { 14 15namespace Network { 16 17enum { 18 B_HTTP_TIME_FORMAT_PARSED = -1, 19 B_HTTP_TIME_FORMAT_RFC1123 = 0, 20 B_HTTP_TIME_FORMAT_PREFERRED = B_HTTP_TIME_FORMAT_RFC1123, 21 B_HTTP_TIME_FORMAT_COOKIE, 22 B_HTTP_TIME_FORMAT_RFC1036, 23 B_HTTP_TIME_FORMAT_ASCTIME 24}; 25 26 27class BHttpTime { 28public: 29 BHttpTime(); 30 BHttpTime(BDateTime date); 31 BHttpTime(const BString& dateString); 32 33 // Date modification 34 void SetString(const BString& string); 35 void SetDate(BDateTime date); 36 37 38 // Date conversion 39 BDateTime Parse(); 40 BString ToString(int8 format = B_HTTP_TIME_FORMAT_PARSED); 41 42private: 43 BString fDateString; 44 BDateTime fDate; 45 int8 fDateFormat; 46}; 47 48} // namespace Network 49 50} // namespace BPrivate 51 52#endif // _B_HTTP_TIME_H_ 53