• Subject: Re: Mcsec in Timestamp, is it possible
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Fri, 16 Feb 2001 11:58:06 -0600 (CST)


The original poster was ALREADY getting his result in MILLIseconds, but
was looking for a way to get his result in MICROseconds.

Microseconds are much smaller than milliseconds.



On Wed, 14 Feb 2001, oludare wrote:

> 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
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.