pdd - Man Page

Tiny date, time difference calculator with timers.

Synopsis

pdd [Options] [KEYWORDS ...]

Description

pdd (python3 date diff) is a small utility to calculate date and time difference. It can also be used as a timer. If no program arguments are specified it shows the current date, time and timezone.

Features

- easy to use, minimal dependencies
- calculate date and time difference
- add, subtract duration (timeslice) to/from date (time)
- calculate diff from today and now
- countdown timer with command piggybacking
- custom resolution stopwatch
- non-verbose mode for background timers
- show current date, time and timezone
- follows ISO 8601

Operational notes

- ISO 8601 format. Month can be specified as month number (e.g. Jan - 1, Dec - 12).
- Time is in 24-hr format.
- The absolute difference is shown. Argument order is ignored.
- The end date is excluded in date difference calculations.
- Hour, minute or second can be omitted. Partial inputs are recognized as mm:ss or ss.
- The keybind to stop timers is Ctrl-C.

Options

-h,  --help

Show help text and exit.

-d,  --date yyyy mmm dd [yyyy mmm dd | y m d]

Calculate date difference.

-t,  --time hh:mm:ss [hh:mm:ss | h:m:s]

Calculate time difference.

--add

Add a duration or timeslice to date (/today) or time (/now).

--sub

Subtract a duration or timeslice from date (/today) or time (/now).

--day yyyy mmm dd

Show the day of the week on a date.

-c,  --timer hh:mm:ss

Set a countdown timer with duration in hours, minutes and seconds.

-r,  --run command

Run command when countdown timer reaches 0.

-s,  --stopwatch [resolution]

Start a custom resolution stopwatch. resolution can range from 1 to 9. Default 3 for millisecond.

-q,  --quiet

Quiet mode for a countdown timer or stopwatch to be run in the background. The counter is shown only when Ctrl-C is pressed.

Examples

  1. Calculate diff from today:

    $ pdd 2014 Jan 15
  2. Calculate diff from now:

    $ pdd 24:00:00
    $ pdd 0
  3. Calculate date diff:

    $ pdd -d 1983 jul 3 2014 1 15
  4. Calculate time diff:

    $ pdd -t 45:50 6:17:33
  5. Show current date, time and timezone:

    $ pdd
  6. Specify time with roll-over:

    $ pdd -t 5:80:75 6:17:33
  7. Add a duration (3 years, 2 months, 1 day) to 28 Feb, 2000:

    $ pdd -d 2000 FEB 28 3 2 1 --add
  8. Add a timeslice (1 hour 2 mins 3 secs) to 23:45:37:

    $ pdd -t 23:45:37 1:2:3 --add
  9. Add a duration (3 years, 2 months, 1 day) to today:

    $ pdd 3 2 1 --add
  10. Add a timeslice (1 hour 2 minutes 3 seconds) to now:

    $ pdd 1:2:3 --add
  11. Subtract a duration (1 day) from 1 Mar, 2000:

    $ pdd -d 2000 Mar 01 0 0 1 --sub
  12. Subtract a timeslice (1 sec) from midnight:

    $ pdd -t 00:00:00 0:0:1 --sub
  13. Subtract a duration (3 years, 2 months, 1 day) from today:

    $ pdd 3 2 1 --sub
  14. Subtract a timeslice (1 hour 2 minutes 3 seconds) from now:

    $ pdd 1:2:3 --sub
  15. Show the day of the week on 15 Jan 2014:

    $ pdd --day 2014 Jan 15
  16. Start a countdown timer or stopwatch in quiet mode in the background:

    $ pdd -qs &
    $ pdd -qc 3:0:0 &

    To see the final counter run fg and press Ctrl-C.

  17. Run a command when countdown timer reaches 0:

    $ pdd -c 00:00:5 -r 'ps -aux'
    $ pdd -c 00:00:5 -r 'notify-send pdd expired'

Authors

Arun Prakash Jana <engineerarun@gmail.com>

Home

https://github.com/jarun/pdd

Reporting Bugs

https://github.com/jarun/pdd/issues

License

Copyright © 2017 Arun Prakash Jana <engineerarun@gmail.com>

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Info

03 Dec 2022 Version 1.7