Giter VIP home page Giter VIP logo

Comments (10)

nyyManni avatar nyyManni commented on August 22, 2024

Interesting. I copied your clock entries to one of my headings and it seems to work as expected.

 09:35 |     54m |  1h  0m | xxx     | xxx
 12:54 |  3h 37m |  3h 30m | xxx     | xxx

First thing that came to my mind would be the locale-specific settings. Would you be able to test with an english locale?

from ejira.

beji avatar beji commented on August 22, 2024

I switched my sytem from german to english (which also updated the locale fields and the current-language-environment values) but it didn't change anything. This seems to indicate a bug in the emacs version, I'll try to get the "official" version going and see if that changes anything.

from ejira.

nyyManni avatar nyyManni commented on August 22, 2024

I am running from the master branch.

If you evaluate (ejira-hourmarking--get-entries "2020-10-27") and check the :start and :end -properties of one of the entries that you are seeing as negative, and give those to time-subtract (like: (time-subtract '(24471 55884) '(24471 52644)) ) does it give you a negative value?

from ejira.

beji avatar beji commented on August 22, 2024

It actually doesn't. The log [2020-10-27 Di 07:50]--[2020-10-27 Di 08:29] => 0:39 results in 07:50 | -21m | -15m and the following time entries: (:start (24471 49944) :start-r (24471 49944) :end (24471 52284) :duration -1260 :duration-r -900). (time-subtract '(24471 52284) '(24471 49944)) result in 2340. Maybe they are used in the wrong order for some reason? start-end instead of end-start

from ejira.

nyyManni avatar nyyManni commented on August 22, 2024

Could you check what does ejira-hourmarking-round return for the following cases:

(ejira-hourmarking-round '(24471 52284) 1)
(ejira-hourmarking-round '(24471 52284) 15)

For me I get:

26940 (#o64474, #x693c)
27000 (#o64570, #x6978)

Trying to narrow down the location where the values go wild.

from ejira.

beji avatar beji commented on August 22, 2024

I got

23340 (#o55454, #x5b2c)
23400 (#o55550, #x5b68)

from ejira.

beji avatar beji commented on August 22, 2024

I changed my system time zone which seems to affect the values here.
Using London gave me

19740 (#o46434, #x4d1c)
19800 (#o46530, #x4d58)

Not sure if this helps

from ejira.

nyyManni avatar nyyManni commented on August 22, 2024

Found the issue:

(defun ejira-hourmarking-round (time round-by)
  "Round TIME to nearest ROUND-BY."
  ;; Account for stupid time zone issues.
  (let* ((hours (- (string-to-number (format-time-string "%H" time)) 2))
         (minutes (string-to-number (format-time-string "%M" time)))
         (total (+ (* 60 hours) minutes))
         (rounded (round total round-by))
         (hours-r (/ rounded (/ 60 round-by)))
         (minutes-r (* round-by (% rounded (/ 60 round-by)))))
     (+ (* 3600 hours-r) (* 60 minutes-r))))

See the - 2 and the comment ;; Account for stupid time zone issues.... Probably not the right place to fix it... Before I can come up with a proper fix adjusting that number 2 there is going to solve the issue for you 😄

from ejira.

beji avatar beji commented on August 22, 2024

Yes, this does the trick. I changed it to a 1 and everything is correct now. Thank you for your time and help, I really appreciate it.

from ejira.

DerBeutlin avatar DerBeutlin commented on August 22, 2024

I experienced the same (also in the mid european time zone).
For me the offset in ejira-hourmarking-round is 2 (probably because of daylight saving time? ) and hardcoding it to 1 fixed it.

from ejira.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.