| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 // Defines utilities for the Timestamp and Duration well known types. |
| 32 |
| 31 #ifndef GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ | 33 #ifndef GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ |
| 32 #define GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ | 34 #define GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ |
| 33 | 35 |
| 34 #include <ctime> | 36 #include <ctime> |
| 35 #include <ostream> | 37 #include <ostream> |
| 36 #include <string> | 38 #include <string> |
| 37 #ifdef _MSC_VER | 39 #ifdef _MSC_VER |
| 38 #include <winsock2.h> | 40 #include <winsock2.h> |
| 39 #else | 41 #else |
| 40 #include <sys/time.h> | 42 #include <sys/time.h> |
| 41 #endif | 43 #endif |
| 42 | 44 |
| 43 #include <google/protobuf/duration.pb.h> | 45 #include <google/protobuf/duration.pb.h> |
| 44 #include <google/protobuf/timestamp.pb.h> | 46 #include <google/protobuf/timestamp.pb.h> |
| 45 | 47 |
| 46 namespace google { | 48 namespace google { |
| 47 namespace protobuf { | 49 namespace protobuf { |
| 48 namespace util { | 50 namespace util { |
| 49 | 51 |
| 52 // Utility functions for Timestamp and Duration. |
| 50 class LIBPROTOBUF_EXPORT TimeUtil { | 53 class LIBPROTOBUF_EXPORT TimeUtil { |
| 51 typedef google::protobuf::Timestamp Timestamp; | 54 typedef google::protobuf::Timestamp Timestamp; |
| 52 typedef google::protobuf::Duration Duration; | 55 typedef google::protobuf::Duration Duration; |
| 53 | 56 |
| 54 public: | 57 public: |
| 55 // The min/max Timestamp/Duration values we support. | 58 // The min/max Timestamp/Duration values we support. |
| 56 // | 59 // |
| 57 // For "0001-01-01T00:00:00Z". | 60 // For "0001-01-01T00:00:00Z". |
| 58 static const int64 kTimestampMinSeconds = -62135596800LL; | 61 static const int64 kTimestampMinSeconds = -62135596800LL; |
| 59 // For "9999-12-31T23:59:59.999999999Z". | 62 // For "9999-12-31T23:59:59.999999999Z". |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 inline ostream& operator<<(ostream& out, const Timestamp& t) { | 287 inline ostream& operator<<(ostream& out, const Timestamp& t) { |
| 285 out << google::protobuf::util::TimeUtil::ToString(t); | 288 out << google::protobuf::util::TimeUtil::ToString(t); |
| 286 return out; | 289 return out; |
| 287 } | 290 } |
| 288 | 291 |
| 289 } // namespace protobuf | 292 } // namespace protobuf |
| 290 | 293 |
| 291 | 294 |
| 292 } // namespace google | 295 } // namespace google |
| 293 #endif // GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ | 296 #endif // GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ |
| OLD | NEW |