TimeSampleHistogram: tweak output
authorDan White <dan@whiteaudio.com>
Thu, 19 Jan 2023 21:44:32 +0000 (15:44 -0600)
committerDan White <dan@whiteaudio.com>
Thu, 19 Jan 2023 21:44:32 +0000 (15:44 -0600)
TimeSampleHistogram

index 53df283079171f09889dd76063daf78a289a6efa..03fbdc915d20e1e67d48b3b5712d5c247d74653c 100755 (executable)
@@ -116,7 +116,7 @@ if isinstance(opt.daysago, int):
 
 # handle -d, --days option
 # if supplied, modify either startdate or enddate accordingly
-if opt.days >= 0:
+if opt.days > 0:
     enddate = startdate + dt.timedelta(opt.days)
 elif opt.days < 0:
     startdate = enddate + dt.timedelta(opt.days)
@@ -139,6 +139,11 @@ if opt.isoweek:
 startdate = dt.datetime.combine(startdate, dt.time.min)
 enddate = dt.datetime.combine(enddate, dt.time.max)
 
+
+# print(opt)
+# print(startdate)
+# print(enddate)
+
 #
 # Sorting options
 #
@@ -233,26 +238,29 @@ ps = '%%-%is (%%%ii)%%s' % (name_len, count_len)
 # Show date range
 #
 if not opt.bare:
-    if opt.today and opt.yesterday:
-        print 'Today (%s) and yesterday' % startdate.strftime('%Y-%m-%d')
+    print 'From:', startdate.strftime('%Y-%m-%d'), ' Thru:', enddate.strftime('%Y-%m-%d')
+
+    if False:
+        if opt.today and opt.yesterday:
+            print 'Today (%s) and yesterday' % startdate.strftime('%Y-%m-%d')
 
-    elif opt.yesterday:
-        if opt.days:
-            print 'From:', startdate.strftime('%Y-%m-%d'), ' Thru',
+        elif opt.yesterday:
+            if opt.days:
+                print 'From:', startdate.strftime('%Y-%m-%d'), ' Thru',
 
-        print 'Yesterday:', startdate.strftime('%Y-%m-%d')
+            print 'Yesterday:', startdate.strftime('%Y-%m-%d')
 
-    elif opt.today:
-        if opt.days:
-            print 'From:', startdate.strftime('%Y-%m-%d'), ' Thru',
+        elif opt.today:
+            if opt.days:
+                print 'From:', startdate.strftime('%Y-%m-%d'), ' Thru',
 
-        print 'Today:', startdate.strftime('%Y-%m-%d')
+            print 'Today:', startdate.strftime('%Y-%m-%d')
 
-    elif startdate > LONG_AGO:
-        print 'From:', startdate.strftime('%Y-%m-%d'), ' Thru:', enddate.strftime('%Y-%m-%d')
+        elif startdate > LONG_AGO:
+            print 'From:', startdate.strftime('%Y-%m-%d'), ' Thru:', enddate.strftime('%Y-%m-%d')
 
-    elif enddate:
-        print 'Thru:', enddate.strftime('%Y-%m-%d')
+        elif enddate:
+            print 'Thru:', enddate.strftime('%Y-%m-%d')
 
     print '-' * opt.width