               sort-value-base (-> last-activity-at
                                (r/iso8601)
                                (r/to-epoch-time)
+                               (r/mul 1000)
                                (r/round))
-              published-sec (-> (r/get-field row [:published-at]) (r/iso8601) (r/to-epoch-time) (r/round))
+              published-ms (-> (r/get-field row [:published-at]) (r/iso8601) (r/to-epoch-time) (r/mul 1000) (r/round))
               has-seen-at? (seq container-last-seen-at)
-              container-seen-sec (when has-seen-at?
+              container-seen-ms (when has-seen-at?
                                   (-> container-last-seen-at
                                    (r/iso8601)
                                    (r/to-epoch-time)
+                                   (r/mul 1000)
                                    (r/round)))
-              last-activity-sec (-> last-activity-at (r/iso8601) (r/to-epoch-time) (r/round))
+              last-activity-ms (-> last-activity-at (r/iso8601) (r/to-epoch-time) (r/mul 1000) (r/round))
               unseen-entry? (r/or (r/not has-seen-at?)
-                                  (r/gt published-sec container-seen-sec))
-              unseen-cap-sec (-> (r/now) (r/to-epoch-time) (r/round) (r/sub unseen-cap-sec))
+                                  (r/gt published-ms container-seen-ms))
+              unseen-cap-ms (-> (r/now) (r/to-epoch-time) (r/mul 1000) (r/round) (r/sub unseen-cap-ms))
               unseen-activity? (r/or unseen-entry?
-                                     (r/gt last-activity-sec container-seen-sec))
+                                     (r/gt last-activity-ms container-seen-ms))
               unseen-with-cap? (r/and unseen-activity?
-                                      (r/gt last-activity-sec unseen-cap-sec))
+                                      (r/gt last-activity-ms unseen-cap-ms))
               sort-value (r/branch unseen-with-cap?
                            ;; If the item is unseen and was published in the cap window
                            ;; let's add the cap window to the publish timestamp so it will sort before the seen items
-                           (r/add sort-value-base unseen-cap-sec)
+                           (r/add sort-value-base unseen-cap-ms)
                            ;; The timestamp in seconds
                            sort-value-base)]
           {;; Date of the last added comment on this thread

                    sort-value-base (-> sort-field
                                     (r/iso8601)
                                     (r/to-epoch-time)
                                     (r/round))
                    unseen-entry? (r/and (seq container-last-seen-at)
                                         (r/gt (r/get-field post-row :published-at) container-last-seen-at))
                    unseen-with-cap? (r/and unseen-entry?
                                            (r/gt sort-value-base
                                                  (-> (r/now) (r/to-epoch-time) (r/round) (r/sub unseen-cap-sec))))
                    sort-value (r/branch unseen-with-cap?
                                ;; If the item is unseen and was published (for recently posted) or bookmarked
                                ;; (for bookmarks) or last activity was (for recent activity) in the cap window
                                ;; let's add the cap window to the publish timestamp so it will sort before the seen ones
                                (r/add sort-value-base unseen-cap-sec)
                                ;; Or use the plain sort value in case it's seen or it's out of the cap window
                                sort-value-base)]
                {;; Date of the last added comment on this entry

                    sort-value (-> last-activity-at
                                (r/iso8601)
                                (r/to-epoch-time)
                                (r/mul 1000)
                                (r/round))]
                {:last-activity-at last-activity-at
                 :sort-value sort-value})))
