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

12
uptimes
View file

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