Skip to content

w3bdev1/timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

timer

A minimal commandline timer in C

Screencast

A screen cast showing timer

Build

    make

Synopsis

    timer [[-m minutes] [-s seconds] | [-t minutes:seconds]] [-hv]

Options

   -m minutes
          number of minutes to count.

   -s seconds
          number of seconds to count.

   -t minutes:seconds
          timestring in minutes:seconds format

   -h     show help information

   -v     show version number

Examples

2 minutes timer

   timer -m 2

30 seconds timer

   timer -s 30

2 minutes 30 seconds timer

   timer -t 2:30

Issues to consider

  • Use standard header for boolean
  • Use block for if
  • Initialize every variable with value
  • Use unisigned int for min and sec
  • timer -t : segfaults
  • Either -s -m or -t flags
  • Make clean target .PHONY
  • Streamline multiple exits
  • Try to be platform independent (unistd.h)
  • Try to use safe versions of string functions
  • Write comparisons in the way that left side is constant.
  • const correctness on each function parameter and, if applicable, on variables

About

A minimal commandline timer in C

Resources

License

Stars

Watchers

Forks