HP3000-L Archives

January 1999, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
in the middle of the pack <[log in to unmask]>
Reply To:
in the middle of the pack <[log in to unmask]>
Date:
Wed, 20 Jan 1999 15:08:36 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (83 lines)
I've not worked in an HP environment for a while, and it was on a "classic"
architecture machine, under MPE 5, so my information might be a little out
of date.

I'll deal with using the CLOCK intrinsic in this post.

As you wrote, the CLOCK intrinsic does return Hour, Minute, Seconds, and
Tenths of a second.  The confusion may have come about because it returns
these four values as a single value.   Note that the value returned is a 32
bit value, which is broken down into four eight bit values, as follows:
    bits   0:8   Hour
    bits   8:8   Minute
    bits 16:8   Seconds
    bits 24:8   10ths  of seconds.

The value you said you got, 220993543 indicates the time, as indicated
below:
    hour:      13   (or 1 PM)
    minute:  44
    second: 24.7


There are several ways you can extract the individual time fields.  The HP
3000 implementation of FORTRAN IV allows a programmer to access groups of
bits.

Since I don't have access to an HP 3000 environment, none of this code has
been compiled or tested:

SUBROUTINE GETTIME (HOUR, MINUTE, SECOND, TENTHS)
        SYSTEM INTRINSIC  CLOCK
        INTEGER*4  SYSTEMTIME
        INTEGER*2  HOUR, MINUTE, SECOND, TENTHS
        INTEGER*2 SYSTIMEA (2)
        EQUIVALENCE (SYSTEMTIME, SYSTIMEA)
        SYSTEMTIME = CLOCK
        HOUR     = SYSTIMEA(1) [0:8]
        MINUTE = SYSTIMEA(1) [8:8]
        SECOND = SYSTIMEA(2) [0:8]
        TENTHS = SYSTIMEA(2) [8:8]
        RETURN
        END

The programming language C also allows access to bit fields, as part of the
standards for that language.

It may be that you don't have access to Fortran or C, but are stuck with
Cobol.  In that case, there are several ways to perform the extraction.  One
way is to divide by 256 four times:

    MOVE SYSTEM-TIME-FIELD TO HOLD-QUOTIENT.


    DIVIDE HOLD-QUOTIENT BY 256 GIVING HOLD-QUOTIENT
            REMAINDER TIME-SUB-FIELD.

    After the 1st division, TIME-SUB-FIELD will hold 10ths of a second.
    After the 2nd division, TIME-SUB-FIELD will hold seconds.
    After the 3rd division,  TIME-SUB-FIELD will hold minutes.
    After the 4th division, TIME-SUB-FIELD will hold hours.

Brad Feazell wrote in message <[log in to unmask]>...
>I'm trying to use the clock intrinsic (in Cobol) to generate a number that
I
>can use for unique file names but I can't figure out what the clock
>intrinsic is giving me. The intrinsics manual says I should get Hour,
>Minute, Seconds and Tenths of seconds.
>
>Here's the number I get: 220993543. A SHOWTIME command at about the same
>time returns MON, JAN 18, 1999,  1:44 PM.
>
>Maybe I'm using the wrong data type/size for the return value: PIC S9(9)
>BINARY SYNC. I don't have much experience calling system intrinsics.
>
>If anyone knows of a better way to create filenames that are guaranteed to
>be unique, I'd like to hear it.
>
>--
>Brad Feazell
>
>
>

ATOM RSS1 RSS2