NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a LabVIEW compatible Timestamp String

Solved!
Go to solution

I'm looking to create a string that represents a timestamp and pass it to LabVIEW.  Understand that Timestamps in TestStand are strings.  I can generate one to pass to LabVIEW with

 

Date() + " " + Time()

 

No problem.  However, I need millisecond resolution from the time.

I then use
Date() + " " + Left(Time(False), Len(Time(False))-3) + "." + Str(Locals.ms,"%03.0f") + " " + Right(Time(False),2)

But it looks like the labview adaptor is nuking the milliseconds still..

But holy crap.. isn't there an easier way to create a valid timestamp for LabVIEW?  I mean without making the timestamp w/in labview and passing it right back into it?

This just seems clunky to me..  I'm hoping i'm missing something stupid on something I would think is a common thing.

 

 

wldgoose_0-1778709398923.png

 

0 Kudos
Message 1 of 4
(141 Views)
Solution
Accepted by wldgoose

Try the solution from How to get milisecond out from time function? post

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
Message 2 of 4
(119 Views)

That was it.  I was stuck searching for "timestamp"

Boy, I wish there was a function LabviewTimestamp()

Seems like a lot of work just to recreate a native LabVIEW structure. 

 

 

Thanks!

-josh

0 Kudos
Message 3 of 4
(96 Views)

For completeness (incase anyone in the future gets here via a search), the link only gets you 80% there.  It would append the millisecond values AFTER the AM or PM string.  I basically ended up building the string from scratch

 

Locals.Time.timeString=Time(False,Locals.Time.hours,Locals.Time.mins,Locals.Time.sec,Locals.Time.ms),
Locals.Time.AMorPM=(Find(Locals.Time.timeString, "AM") >= 0 ? "AM" : "PM"),
Locals.Time.timeString=Date() + " "+ Str(Locals.Time.hours,"%02.0f")+":"+Str(Locals.Time.mins,"%02.0f")+":"+Str(Locals.Time.sec,"%2.0f")+"."+Str(Locals.Time.ms,"%03.0f")+" "+Locals.Time.AMorPM

Message 4 of 4
(87 Views)