Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/rest-api/class-wp-rest-server.php on line 1775
{"id":276,"date":"2016-11-10T11:34:00","date_gmt":"2016-11-10T06:04:00","guid":{"rendered":"http:\/\/ash.wine\/?p=276"},"modified":"2016-11-18T15:27:26","modified_gmt":"2016-11-18T09:57:26","slug":"super-simple-python-timer","status":"publish","type":"post","link":"http:\/\/hacks.ash.wine\/super-simple-python-timer\/","title":{"rendered":"Super Simple Python Timer"},"content":{"rendered":"
\n
\n

\n<\/span><\/a>Super Simple Python Timer<\/h1>\n

Timer module for python to measure elapsed time.<\/p>\n

\n<\/span><\/a>Import<\/h2>\n

Copy Timer.py<\/a> to the same folder as your python files.<\/p>\n

Linux<\/p>\n

\n
wget \"<\/span>https:\/\/gist.githubusercontent.com\/Ashwinning\/313a4bed6af3f7599ac168c4de82b555\/raw\/Timer.py\"<\/span><\/span><\/pre>\n<\/div>\n

Windows<\/p>\n

\n
Invoke-WebRequest<\/span> https:\/\/<\/span>gist.githubusercontent.com\/<\/span>Ashwinning\/<\/span>313a4bed6af3f7599ac168c4de82b555\/<\/span>\nraw\/<\/span>Timer.py -<\/span>OutFile Timer.py<\/pre>\n<\/div>\n

\n<\/span><\/a>Usage<\/h2>\n
\n
from<\/span> Timer import<\/span> Timer\ntimer =<\/span> Timer() #Initialize the timer<\/span>\n#wash clothes for 5 seconds<\/span>\ntimer.print_time() #Print the time elapsed since Initialization (in seconds)<\/span>\n#dry clothes for 3 seconds<\/span>\ntimer.print_new_time() #Print the time elapsed since Initialization and reset the timer<\/span>\n#burn clothes for 10 seconds<\/span>\nprint<\/span> (str<\/span>('<\/span>Burnt clothes for '<\/span><\/span> +<\/span> str<\/span>(timer.get_time() +<\/span> '<\/span> seconds.'<\/span><\/span>)))<\/pre>\n<\/div>\n

Output<\/p>\n

>>> 5\n>>> 8\n>>> Burnt clothes for 10 seconds.\n<\/code><\/pre>\n

\n<\/span><\/a>API<\/h2>\n