[Info-vax] Uptime for OpenVMS
Henry Crun
mike at rechtman.com
Thu May 12 11:41:29 EDT 2011
On 12/05/11 15:30, jbriggs444 wrote:
> On May 11, 12:56 pm, JF Mezei<jfmezei.spam... at vaxination.ca> wrote:
>> OK, in light of Bill Gunshannon's 4000 day uptime, I wanted to "edit"
>> the output of SHOW SYSTEM....
>>
>> VMS Alpha 8.3:
>>
>> $START = "17=NOV-1858 01:00:00"
>> $END = F$TIME()
>> $write sys$output f$delta_time(start,end)
>>
>> %SYSTEM-F-IVTIME, invalid time
>>
>> If I change "start" to have a date last year, it works.
>>
>> Note that by having it at 01:00:00, it means that "start" isn't set to
>> "0" and should not be considered a deltatime.
>>
>> Is this due to a 32 bit limitation in DCL that would not allow a
>> delta-time greater than 32 bits ?
>
> It's a limitation is built into the VMS operating system routines,
> SYS$BINTIM and SYS$ASCTIM. This limitation was carried
> over and documented for certain run time library routines such
> as LIB$ADD_TIMES and LIB$SUB_TIMES.
>
> The limitation is that delta times may not represent intervals
> greater than 9999 days. This was known at one time as the
> D10K problem.
>
> I have strong opinions on the level of intelligence implied by
> the D10K behavior in the relevant vintage of the VMS RTL.
> The RTL enforced the 9999 day limit on delta times not
> just for input/output, but also for internal arithmetic in
> routines such as LIB$ADD_TIMES and LIB$SUB_TIMES.
>
> http://www.b2systems.com/support/delta.html
>
> But I digress.
>
> The output format for a VMS delta time has four digits for
> day number and no provision for overflow. If you try to print
> out a delta time for an interval of some 50,000+ days, it
> won't fit. That is, I believe, the problem you report above.
>
> However, there is another issue with your calculation. VMS
> uptime is not properly computed by subtracting the boot time
> from the current time. It is properly computed by looking
> at EXE$GL_ABSTIME (in seconds).
>
> Assuming unsigned arithmetic, the former puts a limit of
> 49,710 days (136 years) of uptime on any VMS system
> in which ABSTIME is maintained in an unsigned 32 bit cell.
>
> The question of signed versus unsigned arithmetic is
> largely academic since we haven't had any systems up
> for 68 years yet and because...
>
> My recollection is that "SHOW SYSTEM" uses the incorrect
> computation for uptime and does, in fact, subtract boot time
> from time now. This can give rise to absolute times showing
> up in the "SHOW SYSTEM" uptime display if you change
> the system clock backward far enough.
Found "among my souvenirs' : (look out for line wrap)
---------------------<start code>-------------------------------
.title get system up time
.link /sys$system:sys.stb/
;
; for Alpha: link/SYSEXE
;
; Macro to setup calling sub-routine
;
.macro call_division dvsr, dvdent, quot, remainder
pushl dvsr
pushl dvdent
pushal quot
pushal remainder
calls #4, division
.endm call_division
.psect data, long, wrt, noexe
up_sec: .long 0
hrs: .long 0
min: .long 0
sec: .long 0
day: .long 0
sec_remain:.long 0
min_remain:.long 0
hrs_remain:.long 0
q_tmp: .quad 0
sixty: .long 60
hrs_in_day:.long 24
ctrstr: .ascid /System has been up for !UL day!%S, !UL hour!%S, <<<- line wrap!
!UL minute!%S and !UL second!%S/
outdesc: .long 80
.address outstr
outstr: .blkb 80
outlen: .long 0
.psect code, long, exe
.entry uptime,0
movl g^exe$gl_abstim, up_sec
;
; Calculate number of minutes and store remaining seconds
;
cal_min:
call_division sixty, up_sec, min, sec_remain
cmpl min, #0
beql skip
;
; Calculate number of hours and store remaining minutes
;
cal_hrs:
call_division sixty, min, hrs, min_remain
cmpl hrs, #0
beql skip
;
; Calculate number of days and store remaining hours
;
cal_day:
call_division hrs_in_day, hrs, day, hrs_remain
; cmpl hrs, #0
; beql skip
;
; Format the output string to be printed out
;
skip:
$fao_s ctrstr=ctrstr, -
outlen=outlen, -
outbuf=outdesc, -
p1=day,-
p2=hrs_remain,-
p3=min_remain,-
p4=sec_remain
movl outlen, outdesc
pushal outdesc
calls #1, g^lib$put_output
ret
;
; Routine to do the divisions
;
.entry division, ^m<>
clrq q_tmp
movl 4(ap), r5 ;remainder
movl 8(ap), r6 ;quotient
movl 12(ap), q_tmp ;dividend
movl 16(ap), r8 ;divisor
ediv r8, q_tmp, (r6), (r5)
ret
.end uptime
---------------------------<end code>----------------------------
--
Mike R.
Home: http://alpha.mike-r.com/
QOTD: http://alpha.mike-r.com/php/qotd.php
No Micro$oft products were used in the URLs above, or in preparing this message.
Recommended reading: http://www.catb.org/~esr/faqs/smart-questions.html#before
More information about the Info-vax
mailing list