Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- '''
- Show system uptime in *nix platforms
- '''
- __version__ = '0.0.1'
- __author__ = {'Mauro Baraldi': 'mauro.baraldi@gmail.com'}
- import os
- from datetime import datetime
- def uptime():
- with open( "/proc/uptime" ) as ut:
- uptime = datetime.fromtimestamp(float(ut.read().split()[0]))
- return "The system uptime for %i days, %i hours, %i minutes, %i seconds" % (uptime.day, uptime.hour, uptime.minute, uptime.second)
- if __name__ == "__main __":
- print uptime()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement