× 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.



I should point out that what I attached was V5R4 documentation. In V6R1 the
standard time format provides time with 52 bits, giving 1 microsecond
granularity. (I really need to stop using the V5R4 Info Center...)

On Tue, Feb 23, 2010 at 1:53 PM, Bruce Vining <bvining@xxxxxxxxxxxxxxx>wrote:

Those terms all refer to a common format for time. From the Information
Center:


The *Standard Time Format* is defined as a 64-bit (8-byte) unsigned binary
value as follows:
Offset
Dec Hex
Field Name
Data Type and Length 0 0
Standard Time Format
UBin(8) 0 0
Time
Bits 0-48 0 0
Uniqueness bits
Bits 49-63 8 8
--- End ---

The *time* field is a binary number which can be interpreted as a time
value in units of 8 microseconds. A binary 1 in bit 48 is equal to 8
microseconds.

The *uniqueness bits* field may contain any combination of binary 1s and
0s. These bits do not provide additional granularity for a time value; they
merely allow unique 64-bit values to be returned, such as when the value of
the *time-of-day (TOD) clock* is materialized.

A number of MI instructions define fields to contain a binary value which
may represent a time stamp or time interval, or may specify a wait time-out
period. Unless explicitly stated otherwise, the format of the field is the
*Standard Time Format*.

Examples of binary values as time intervals:

A hex value of... Represents...
0000000000008000 8 microseconds
00000000F4240000 1 second
00000D693A400000 1 hour
0008CD0E3A000000 1 week

Examples of binary values as time stamps:

A hex value of... Represents...
0000000000000000 08/23/1928 12:03:06.314752
4A2FEC4C82000000 01/01/1970 00:00:00.000000
8000000000000000 01/01/2000 00:00:00.000000
DFFFFFFFFFFF8000 07/07/2053 20:57:40.263928




On Tue, Feb 23, 2010 at 12:11 PM, Vern Hamberg <vhamberg@xxxxxxxxxxx>wrote:

A lot of different terms are used, it seems, for the same things. So I'm
wondering about "system timestamp". Are these the same thing?

1. TOD value returned by the MATTOD MI function
2. System clock as discussed in documentation for CVTD MI function
3. *DTS as discussed in documentation for QWCCVTDT API

So far as I can tell, TOD and *DTS are the same, since the range of
dates is the same - back to somewhere in 1928 and up through somewhere
in 2071

Thanks
Vern

Paul Jackson wrote:
On Fri, Feb 19, 2010 at 5:22 PM, Simon Coulter <shc@xxxxxxxxxxxxxxxxx>
wrote:

On 20/02/2010, at 10:47 AM, Paul Jackson wrote:


What is the current recommended method of converting a "system
timestamp" date (8 bytes) into a regular RPG native timestamp field?
I've seen a bunch of date and time API's/MI instructions out there so
was curious as to the best method to use. I will be doing this
conversion many hundreds of thousands of times and so would be looking
for the quickest method (assuming there is a big difference between
them).

I've used QWCCVTDT before, should I just stick with that?

That's the easiest method but is likely slower than the MI version.
You would be trading ease for speed. The only way to know for sure is
to perform empirical tests but I suspect the call overhead to the API
will be measurable over "many hundreds of thousands" of iterations.

If you use the MI built-in _CVTD then you'll need to build appropriate
DDAT structures for the input and output dates. Not difficult but lots
of sub-fields to set and offsets to calculate correctly.

Search the archives for additional information on DDAT structures.


Thanks Simon, I will search further.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




--
Regards,
Bruce
www.brucevining.com
www.powercl.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.