summaryrefslogtreecommitdiff
path: root/src/core/util.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/util.vala')
-rw-r--r--src/core/util.vala11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/util.vala b/src/core/util.vala
index 461d2c0..8e0f92f 100644
--- a/src/core/util.vala
+++ b/src/core/util.vala
@@ -198,4 +198,15 @@ public static int64 nullsafe_date_time_comperator(DateTime? time_a, DateTime? ti
return time_a.compare(time_b);
+}
+
+/*
+ * Drop microseconds from input DateTime
+ */
+public DateTime? coarsify_date_time(DateTime? dt) {
+ if (dt == null) {
+ return null;
+ }
+
+ return dt.add(-dt.get_microsecond());
} \ No newline at end of file