;******************************************************************************* ;* What_uptime * ;* This procedure is intended to return a formated string of the current * ;* time a CPU has been up, given its boot time. * ;******************************************************************************* ; .title WHAT_UPTIME ; .psect what_uptime_data, con, lcl, noexe, noshr, pic, rel, wrt ; epoch: .quad 0 ; Used to make delta positive curr_time: .quad 0 ; Current time program is run delta_time: .long 0 ; Storage place for delta time up_half: .long 0 ; - after subtraction ; .psect what_uptime_code, con, exe, lcl, shr, nowrt, pic, rel ; .entry what_uptime, ^m ; movl 4(ap), r11 ; Boot time needed to be converted movl 8(ap), r10 ; Descriptor of time buffer movl 12(ap), r9 ; Length of the returned string ; $gettim_s - timadr = curr_time ; Get the current time ; pushal delta_time pushl r11 ; Subtract boot time from current pushal curr_time ; - time to find uptime. calls #3, g^lib$subx ; bbs #31, up_half, 10$ ; If bit 31 set, its is negative ; pushal delta_time pushal delta_time ; Subtract the time so that pushal epoch ; - it is positive calls #3, g^lib$subx ; 10$: $asctim_s - ; Convert the delta time to timlen = (r9), - ; - a string timbuf = (r10), - timadr = delta_time ; ret ; End of What_uptime ; .end