Commits

Brian Mearns committed 452bd41

Negated the offset, so negative is past, positive is future.

Comments (0)

Files changed (2)

-* Negate offset. It should be added to the current time so that negative is the past, positive is the future
 * Stop using hgconfig extension, natively edit the config file.
 * Have --clear actually remove the option.
 * Add a --now or --reset option to set the offset to 0, use real time. Different from --clear.
         ref = util.parsedate(date)
         ref_utc = long(ref[0]) + ref[1]
 
-        delta = cur_utc - ref_utc
+        delta = ref_utc - cur_utc
         repo.hgdate.setOffset(ui, repo, delta)
 
         if ui.debugflag:
     ### Show the current offset
     if ui.verbose or date is None:
         offset = repo.hgdate.offset
-        now = cur[0] - offset
+        now = cur[0] + offset
 
         debug(ui, _("Date offset: ") + str(offset) + _(" sec"))
         if ui.verbose:
             else:
                 aoff = offset
                 if offset < 0:
-                    whence = "future"
+                    whence = "past"
                     aoff = -offset
                 else:
-                    whence = "past"
+                    whence = "future"
                 ui.note(_("Date offset: "))
                 ui.note(str(datetime.timedelta(seconds=aoff)) + _(" (%s)\n" % whence), label="hgdate.offset")
             
             hgd = self.hgdate
             if not hgd.date_set:
                 d = ctx._date
-                ctx._date = (d[0] - hgd.offset, d[1])
+                ctx._date = (d[0] + hgd.offset, d[1])
             return super(hgdate_repo, self).commitctx(ctx, *args, **kwargs)
     repo.__class__ = hgdate_repo