This commit is contained in:
iridiumR 2023-08-07 23:58:01 +08:00
parent f24a4d6982
commit 5d3886bb51
No known key found for this signature in database
GPG key ID: 49735733EB1A32C8
2 changed files with 13 additions and 3 deletions

View file

@ -1,6 +1,6 @@
# Maintainer: 1ridic <i@8f.al>
pkgname=uptimes
pkgver=0.1.9
pkgver=0.1.10
pkgrel=1
pkgdesc="status of total uptime"
arch=('any')
@ -11,7 +11,7 @@ source=(
local://uptimes
local://uptimesd.service
)
md5sums=('9eecdc39ee18e28843b1e113fd6090c6'
md5sums=('542ca1de161e15d32b386e9470ac6811'
'7a90889f87792317e70ebdce9dae7023')
package() {

12
uptimes
View file

@ -40,7 +40,17 @@ def timeInit():
def updateTime():
global uptime, startTime, totalTime
now = readTime()
print("Now: %f" % now)
sys.stdout.flush()
print("Uptime: %f" % uptime)
sys.stdout.flush()
print("startTime: %f" % startTime)
sys.stdout.flush()
print("totalTime: %f" % totalTime)
sys.stdout.flush()
totalTime += now - startTime
print("totalTime: %f" % totalTime)
sys.stdout.flush()
with open(uptimes_db, 'w') as f:
f.write(str(totalTime))
@ -196,7 +206,7 @@ def daemon(fork = True):
elif data == b'get':
updateTime()
conn.sendall(b'%f' % uptime)
conn.sendall(b'%f' % totalTime)
conn.close()
continue