From ab731c82cd86d798feff2173561e0b9123b919f5 Mon Sep 17 00:00:00 2001 From: Dan White Date: Thu, 19 Jan 2023 15:44:32 -0600 Subject: [PATCH] TimeSampleHistogram: tweak output --- TimeSampleHistogram | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/TimeSampleHistogram b/TimeSampleHistogram index 53df283..03fbdc9 100755 --- a/TimeSampleHistogram +++ b/TimeSampleHistogram @@ -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 -- 2.25.1