Skip to content

Instantly share code, notes, and snippets.

@VladSem
Last active October 1, 2015 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VladSem/3984980ae073e4c36f82 to your computer and use it in GitHub Desktop.
Save VladSem/3984980ae073e4c36f82 to your computer and use it in GitHub Desktop.
Pyhon: elapsed time
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
modem_status = ''
start_time = time.time()
attempts_time = 0
modem_status = 'Connected'
end_time = time.time()
total_time = end_time - start_time
hours = total_time // 3600
total_time -= 3600 * hours
minutes = total_time // 60
seconds = total_time - 60 * minutes
final_time = ('%d:%d:%d' % (hours, minutes, seconds))
print 'Modem status: ' + modem_status + ' Test passed'
print 'Connec. time: ' + final_time
print 'Attempts: ' + str(attempts_time) + ' time(s)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment