src/lib/ASN1ContentHandler.h
branchv_0
changeset 22 9b6f86760384
parent 21 705036445672
child 23 8941a679299f
equal deleted inserted replaced
21:705036445672 22:9b6f86760384
   199 		int8_t month = 1;
   199 		int8_t month = 1;
   200 		int8_t day = 1;
   200 		int8_t day = 1;
   201 		int8_t hour = 0;
   201 		int8_t hour = 0;
   202 		int8_t minute = 0;
   202 		int8_t minute = 0;
   203 		int8_t second = 0;
   203 		int8_t second = 0;
   204 		// TODO: ms/ns
   204 		int32_t nanosecond = 0;
       
   205 		int8_t timezoneHour = 0;
       
   206 		int8_t timezoneMinute = 0;
   205 
   207 
   206 		virtual ~DateTime() {
   208 		virtual ~DateTime() {
   207 		}
   209 		}
   208 
   210 
   209 		const std::string toString() const {
   211 		const std::string toString() const {
   213 			result << "-" << std::setw(2) << (int) month;
   215 			result << "-" << std::setw(2) << (int) month;
   214 			result << "-" << std::setw(2) << (int) day;
   216 			result << "-" << std::setw(2) << (int) day;
   215 			result << "T" << std::setw(2) << (int) hour;
   217 			result << "T" << std::setw(2) << (int) hour;
   216 			result << ":" << std::setw(2) << (int) minute;
   218 			result << ":" << std::setw(2) << (int) minute;
   217 			result << ":" << std::setw(2) << (int) second;
   219 			result << ":" << std::setw(2) << (int) second;
   218 			result << "+00:00"; // TODO: timezone
   220 			if (precision == Precision::Nanosecond) result << "," << (int) nanosecond;
       
   221 			result << (timezoneHour < 0 ? "-" : "+");
       
   222 			result << std::setw(2) << (int) std::abs(timezoneHour);
       
   223 			result << ":" << std::setw(2) << (int) timezoneMinute;
   219 			return result.str();
   224 			return result.str();
   220 		}
   225 		}
   221 	};
   226 	};
   222 
   227 
   223 	virtual ~ASN1ContentHandler() = default;
   228 	virtual ~ASN1ContentHandler() = default;