UpTime() - Tietokoneen päälläoloaika

Oletko tehnyt jotain, mistä muut voisivat hyötyä. Postita vinkit tänne.
Post Reply
MaGetzUb
Guru
Posts: 1715
Joined: Sun Sep 09, 2007 12:35 pm
Location: Alavus

UpTime() - Tietokoneen päälläoloaika

Post by MaGetzUb »

Jooh, tuli väsättyä tämmööne funktio, se kertoo tietokoneen yhtäjaksoisen päälläoloajan tyyliin: Päivät:Tunnit:Minuutit:Sekunnit.

Code: Select all

Const UT_WHOLE_TIME = 0
Const UT_TXT_TIME = 1
Const UT_DD = 2
Const UT_HH = 3
Const UT_MM = 4
Const UT_SS = 5

Repeat 
    Text 0, 0,"Tietokoneesi o"+"n ollut päällä yhtäjaksoisesti: "
    Text 0, 15, UpTime(UT_WHOLE_TIME)   
    DrawScreen
Forever 


Function UpTime(style = 0)
    ctimer = Timer()
    
    dd$ = Str(ctimer / 86400000)
    hh$ = Str((ctimer / 3600000) Mod 24)
    mm$ = Str((ctimer /   60000) Mod 60)
    ss$ = Str((ctimer /    1000) Mod 60)
    
    If Len(dd) = 1 Then dd = "0"+dd
    If Len(hh) = 1 Then hh = "0"+hh
    If Len(mm) = 1 Then mm = "0"+mm
    If Len(ss) = 1 Then ss = "0"+ss
    
    Select style 
    
        Case 1 : Return dd+"d "+hh+"h "+mm+"m"+"in "+ss+"sec"
        
        Case 2 : Return dd$
        
        Case 3 : Return hh$
        
        Case 4 : Return mm$
        
        Case 5 : Return ss$
        
        Default : Return dd+":"+hh+":"+mm+":"+ss
        
    EndSelect     
EndFunction 
EDIT:

Nimi muutettu

Last edited by MaGetzUb on Thu Jun 02, 2011 12:26 am, edited 3 times in total.
Solar Eclipse
Meneillä olevat Projektit:
We're in a simulation, and God is trying to debug us.
User avatar
esa94
Guru
Posts: 1855
Joined: Tue Sep 04, 2007 5:35 pm

Re: WakeTime() - Tietokoneen päälläoloaika

Post by esa94 »

Miten ois perinteisesti uptime
MaGetzUb
Guru
Posts: 1715
Joined: Sun Sep 09, 2007 12:35 pm
Location: Alavus

Re: WakeTime() - Tietokoneen päälläoloaika

Post by MaGetzUb »

esa94 wrote:Miten ois perinteisesti uptime
Ai niin, no se vaihdanpa nyt vielä kerran uudestaan. :) Ei tuommoosia seikkoja muista. :D
Solar Eclipse
Meneillä olevat Projektit:
We're in a simulation, and God is trying to debug us.
Post Reply