Git Product home page Git Product logo

Comments (2)

jarun avatar jarun commented on June 1, 2024

Hi,

Somehow I missed this big time.
Can you please raise a PR to do this? Probably an environment variable which the utility would read and follow.

from pdd.

jarun avatar jarun commented on June 1, 2024

There are issues with using strftime. Here's a crude example:

~/G/pdd$ gd
diff --git a/pdd b/pdd
index f1d48e7..f679222 100755
--- a/pdd
+++ b/pdd
@@ -19,8 +19,8 @@
 
 import argparse
 import calendar as cal
-from datetime import date
-from datetime import datetime
+import datetime
+#from datetime import datetime
 from dateutil.relativedelta import relativedelta
 import os
 import sys
@@ -129,14 +129,8 @@ def showtimediff(t0, t1):
 
     m, s = divmod(abs(t0 - t1), 60)
     h, m = divmod(m, 60)
-    d, h = divmod(h, 24)
-
-    if d > 0:
-        print('day %d, %02d:%02d:%02d' % (d, h, m, s))
-    else:
-        print('%02d:%02d:%02d' % (h, m, s))
-
-    print('%ds' % abs(t0 - t1))
+    t = datetime.time(h, m, s)
+    print(t.strftime('%H %M %S'))
 
 
 def showtimesum(t0, t1):
~/G/pdd$ ./pdd -t 28:00:00 1:01:59
error: hour must be in 0..23

Currently this works like a charm and shows the number of days.

from pdd.

Related Issues (15)

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.