infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
command for getting current time with milliseconds
Hongle Sun
I am using [clock format [clock seconds] -format "%Y%M%d%H%M%S"] to retrieve current system date upto seconds.
The output for the above statement is "201009291510129", but I would like to know if there is a similar way to retrieve upto milliseconds in the above format. Thanks
Find more posts tagged with
Clovertech
Comments
david_barr
Why do you need to do this?
You can use "clock clicks" to get a time counter in milliseconds, but this value doesn't seem to be synchronized with "clock seconds". In other words, [expr [clock clicks -milliseconds]%1000] doesn't go to zero at the time that [clock seconds] changes.
Hongle Sun
Thanks David. I actully would like to use the system timestamp with millisecond to be messsage_control id within ADT message.
Jim Kosloskey
Hongle,
What I do is to use the clock seconds plus a 3 character literal plus a counter. The counter breaks ties at the seconds level, the literal means I can have uniqueness accross systems as well as within a system (across sytems can be useful if the receiving system is getting messages from multiple sources (ADT, Orders, Results, etc.) and every message has to have a unique ID forever.
The above mecahnism can assure such uniqueness and still stay within the 22 character limit of MSH-10.
david_barr
Well, if you're mostly concerned with uniqueness, you could use something like
clock format [clock seconds] -format "%Y%M%d%H%M%S[expr [clock clicks -milliseconds]%1000]"
.
Just be aware that the milliseconds portion of the time will probably guarantee uniqueness, but won't always be sequential. In other words, a message may come in the same second as another message, and it's timestamp might have a lower value.
Jim Kosloskey
Dave,
I don't think that will assure uniqueness since the value gene4rated by the clock clicks -milliseconds will have the same value within a given second. So if multiple messages are delviered per second they will all have the same ID.
david_barr
clock clicks -milliseconds gives you a counter that changes each millisecond, so if you call it twice within a second (but not within a millisecond) it will be unique.