× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Mcsec in Timestamp, is it possible
  • From: "York, Albert" <albert.york@xxxxxxxxxxxxxx>
  • Date: Sun, 25 Feb 2001 10:01:47 -0800

I'm not sure that you can say it's guaranteed to be unique. If you have a
machine with more than one processor you could conceivably) end up with
duplicate times when running multiple jobs. Admittedly, the chance is very
small. However, you could append the job number to make it unique.

Albert York     

        From:   Leif Svalgaard [SMTP:leif@leif.org]
        Sent:   Sunday, February 25, 2001 8:30 AM
        To:     MIDRANGE-L@midrange.com
        Subject:        Re: Mcsec in Timestamp, is it possible

        NOW you tell us what you really want:  just a unique
        timestamp, not really the time with microsecond
        resolution. The time stamp value returned by the
        machine is guaranteed to be unique.

        ----- Original Message -----
        From: Dimitri Efimov <defimov@wiese.com.pe>
        To: <MIDRANGE-L@midrange.com>
        Sent: Friday, February 16, 2001 9:23 AM
        Subject: RE: Mcsec in Timestamp, is it possible


        Sorry,

        but the question was to optain the system time in MICROSECONDS
(1/1000000)-
        to get milliseconds is enought to use command "time" in RPGLE. The
point is
        that millisecond accurancy cannot garantie the unique key in the
machine
        like 840.

        The solution of Scott is great. The example had no proble to
compile.

        Thanks,

        Dmitri


        -----Mensaje original-----
        De: oludare [mailto:oludare@ix.netcom.com]
        Enviado el: miércoles, 14 de febrero de 2001 16:07
        Para: MIDRANGE-L@midrange.com
        Asunto: Re: Mcsec in Timestamp, is it possible


        FYI,

        OBTAINING THE SYSTEM TIME IN MILLISECONDS
        There are times when it can be handy to obtain the system time with
        milliseconds - for example, when you want to create a unique
        identifier for data transfers. Although you can retrieve this data
        using the QWCRSVAL (Retrieve System Value) API, the QWCCVTDT
(Convert
        Date and Time Format) API is easier to use and understand. QWCCVTDT
is
        documented in OS/400 Miscellaneous APIs (SC41-4880) at
        
http://publib.boulder.ibm.com/pubs/html/as400/v4r5/ic2924/info/apis/misc1htm
        ..

        Passing *CURRENT to QWCCVTDT as the input format value returns the
        current system date and time. As shown in the sample program below,
        you can control the returned date format by changing the OutFmt
        (output format) value. By default, the system returns dates in a
year-
        month-day (*YYMD) format; OutFmt lets you select another format from
        the additional choices of day-month-year (*DMYY), month-day-year
        (*MDYY), or long Julian (*LONGJUL). Note that only three significant
        digits are returned for the milliseconds rather than the full six
        digits that make up the milliseconds.

         *========================================================
         * To compile:
         *
         * CRTBNDRPG PGM(XXX/TIMER) SRCFILE(XXX/QRPGLESRC)
         *
         * From  "Tech Corner," May 1998
         *
         * Copyright (c) 1998 Duke Communications International,
         * ALL RIGHTS RESERVED
         *========================================================

         * Convert date / time (QWCCVTDT) API

        D InpFmt          S             10 Inz( '*CURRENT' )
        D InpTim          S             16 Inz( *ZEROS )
        D OutFmt          S             10 Inz( '*YYMD' )

         * Current date and time

        D CurDatTim       DS
        D   CurDat                       8S 0
        D   CurTim                       9S 0

         * Error code data

        D ErrData         DS
        D   BytesProv             1      4B 0 Inz( 272 )
        D   BytesAval             5      8B 0
        D   ExcpId                9     15A
        D   Reserved             16     16A
        D   ExcpData             17    272A

        C     *Entry        Plist
        C                   Parm                    CurDatTim

        C                   Call      'QWCCVTDT'
        C                   Parm                    InpFmt
        C                   Parm                    InpTim
        C                   Parm                    OutFmt
        C                   Parm                    CurDatTim
        C                   Parm                    ErrData

        C                   Return

        The following CL program returns the 16-byte date and time value,
        including milliseconds:

        PGM
        DCL &TIME *CHAR 16
        DCL &ERR  *CHAR  4 VALUE(X'00000000')
        CALL QWCCVTDT PARM('*CURRENT ' XX '*YMD ' &TIME &ERR)
        SNDPGMMSG &TIME
        ENDPGM

        The date and time are returned in the following format:

        1     : Century, where 0=years 19xx and 1=years 20xx
        2-7   : Date
        8-13  : Time, in HHMMSS (hours, minutes, seconds) format
        14-16 : Milliseconds

        The above tip was adapted from a NEWS/400 tip by Terrance Ramirez
and
        IBM Knowledgebase item 8134953
        ----- Original Message -----
        From: "Buck Calabro" <buck.calabro@aptissoftware.com>
        To: <MIDRANGE-L@midrange.com>
        Sent: Wednesday, February 14, 2001 8:57 AM
        Subject: RE: Mcsec in Timestamp, is it possible


        > Scott,
        > Many thanks for the example.  I was looking in the MI library for
the
        right
        > functions (MATTOD and MIDDTM) and foolishly didn't think of the
Unix
        > library.  I really need to take a C course and learn about the
standard
        > library.
        > Anyway, thanks for broadening my horizon!
        >
        > Buck
        >
        > > -----Original Message-----
        > > From: Scott Klement
        > > Sent: Tuesday, February 13, 2001 7:10 PM
        > > To: MIDRANGE-L@midrange.com
        > > Subject: RE: Mcsec in Timestamp, is it possible
        > >
        > > I never needed microseconds on the AS/400....
        > > though UNIX/POSIX does it with
        > > the gettimeofday() function.
        > -snip-
        > +---
        > | This is the Midrange System Mailing List!
        > | To submit a new message, send your mail to
MIDRANGE-L@midrange.com.
        > | To subscribe to this list send email to
MIDRANGE-L-SUB@midrange.com.
        > | To unsubscribe from this list send email to
        MIDRANGE-L-UNSUB@midrange.com.
        > | Questions should be directed to the list owner/operator:
        david@midrange.com
        > +---

        +---
        | This is the Midrange System Mailing List!
        | To submit a new message, send your mail to
MIDRANGE-L@midrange.com.
        | To subscribe to this list send email to
MIDRANGE-L-SUB@midrange.com..
        | To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
        | Questions should be directed to the list owner/operator:
        david@midrange.com
        +---
        +---
        | This is the Midrange System Mailing List!
        | To submit a new message, send your mail to
MIDRANGE-L@midrange.com.
        | To subscribe to this list send email to
MIDRANGE-L-SUB@midrange.com..
        | To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
        | Questions should be directed to the list owner/operator:
david@midrange.com
        +---

        +---
        | This is the Midrange System Mailing List!
        | To submit a new message, send your mail to
MIDRANGE-L@midrange.com.
        | To subscribe to this list send email to
MIDRANGE-L-SUB@midrange.com.
        | To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
        | Questions should be directed to the list owner/operator:
david@midrange.com
        +---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.