Skip to content

Commit

Permalink
Merge pull request #22 from barbudor/add_filter_uptimesec
Browse files Browse the repository at this point in the history
add filter uptimesec
  • Loading branch information
eschava authored Oct 18, 2021
2 parents 7dff701 + bbf906f commit 0f4e16a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ def uptime(boot_time):
return retval


def uptimesec(boot_time):
import time
upt = time.time() - boot_time

return round(upt)


def register_filters(env):
env.filters['KB'] = kb
env.filters['MB'] = mb
env.filters['GB'] = gb
env.filters['uptime'] = uptime
env.filters['uptimesec'] = uptimesec

0 comments on commit 0f4e16a

Please sign in to comment.