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



This uniqueness thing, and the 12-digits setting, have been intriguing. I have had reason to work with the MI function MATTOD - Materialize Time of Day. This returns an 8-byte value, the most left-hand bits contain a count of the ticks of the system clock. Now in an article, at https://www.ibm.com/support/pages/difference-between-time-opcode-rpg-and-mi-instruction-mattod, last modified in July, 2021, it says that the system clock resolution  is +/- 8 microseconds. In the TOD value, the right-hand bits provide uniqueness - as that article says, "Note:  On more powerful IBM i models, the MATTOD instruction can run fast enough that multiple invocations of it completes within the same 8-microsecond window, therefore, returning identical timestamps."

Since 7.1, at least, I think the resolution is now +/- 1 microsecond - the number of bits in that TOD, which used to be the count of 8-microsecond ticks, has been changed. Now since it changed, it is the #51 bit from the left, counting from 0. All the remaining bits are a uniqueness value. There will likely be someone to confirm this, the recent MI C/C++ manual says it is a count of microseconds.

Anyhow, why do I mention all this? Because of the recent uniqueness stuff in the timestamp data type. I don't know that the uniqueness comes from those bits in the TOD value - that is 12 bits, and the largest value in 12 bits is 4096, right? In the datatype, the uniqueness digits are 6, so up to 999999, right?

Still, when Barbara says that the true resolution is still microseconds, that does match what I understand of that current TOD structure.

OK, enough rambling while watching the Gophers beating Michigan State in hockey!!
Regards
Vern

On 2/4/2022 5:27 PM, Barbara Morris wrote:
On 2022-02-03 11:22 p.m., Birgitta Hauser wrote:
If you need all 12 digits, you can use the SQL Timestamp, you can get all 12
digits:

Exec SQL Set :YourTimestamp = Current_Timestamp(12);


Current_Timestamp(12) is similar to %TIMESTAMP(*UNIQUE) in that the returned timestamp has only microsecond precision. The last 6 digits are "uniqueness" digits; they don't add any extra accuracy to the timestamp.



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.