|
> >I would not depend on using the timestamp as a unique key. As you have >found out, on a sufficiently fast enough machine you can get duplicates. >The upshot of this is that even if it works today, when the next generation >of CPUs come out it might fail. > Just wanted to point out that there is a unique timestamp available on the system. If you access the system Time of Day (TOD) clock then the full 8-byte value will be unique. This uniqueness is ensured by the system so long as you do not set the system time backwards (which means there currently is a small exposure for those systems that observe Daylight Saving Time/Standard Time). To access the TOD in RPG use: DMatTOD PR EXTPROC('_MATTOD') D 8 DReceiver s 8 C callp MatTOD(Receiver) Receiver can then be converted to a more readable format using the Convert Date and Time (QWCCVTDT) API and format *DTS. The *DTS format itself measures time with 8-microsecond granularity, and uses bits beyond bit 48 (base 0) to provide unique values for when multiple accesses to the TOD may occur within the same 8-microsecond interval. Bruce Vining +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-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 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.