chaokunyang commented on code in PR #3789:
URL: https://github.com/apache/fory/pull/3789#discussion_r3474310535
##########
cpp/fory/serialization/temporal_serializers.h:
##########
@@ -21,21 +21,63 @@
#include "fory/serialization/serializer.h"
#include <chrono>
+#include <functional>
#include <limits>
namespace fory {
namespace serialization {
// ============================================================================
-// Temporal Type Aliases
+// Fory-owned temporal carrier types
// ============================================================================
/// Duration: absolute length of time as nanoseconds
-using Duration = std::chrono::nanoseconds;
+class Duration {
+public:
+ Duration() : ns_(0) {}
+
+ explicit Duration(std::chrono::nanoseconds ns) : ns_(ns) {}
+
+ std::chrono::nanoseconds to_chrono() const { return ns_; }
+
+ int64_t count() const { return ns_.count(); }
+
+ bool operator==(const Duration &other) const { return ns_ == other.ns_; }
+
+ bool operator!=(const Duration &other) const { return !(*this == other); }
+
+ bool operator<(const Duration &other) const { return ns_ < other.ns_; }
+
+private:
+ std::chrono::nanoseconds ns_;
+};
/// Timestamp: point in time as nanoseconds since Unix epoch (Jan 1, 1970 UTC)
-using Timestamp = std::chrono::time_point<std::chrono::system_clock,
- std::chrono::nanoseconds>;
+class Timestamp {
Review Comment:
put timestamp and duration into cpp/fory/type/temporal.h and
cpp/fory/type/duration.h
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]