From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

During a test, how can I find the start time and date of that test?

I want to log results to a database in the middle of a test. How can I find the starting time/date stamp for the currently running test?
0 Kudos
Message 1 of 8
(6,407 Views)
Hi Tdot,

If you are using a process model, there is a step inside of the default model entry points that takes a timestamp at the beginning of your test (i.e. before calling the MainSequence callback). So inside of your test sequence you can access RunState.Root.Locals.StartTime.Text to get the time your test began. If you are not using a model, or have deleted this step, then you need to take a timestamp at the point which you want to consider time zero and then take a timestamp at time t and subtract the two to get the total time. TestStand has a number of time functions that you can use and can be found on the Operators tab of the Expression Browser under the heading Time. Hope this helps!

Bob
Message 2 of 8
(6,408 Views)

I created a message popup and tried accessing RunState.Root.Locals.StartTime from a f(x) button.  The expansion (+) get me only as far as Root.  I typed in the rest by hand and it said, (paraphrase) "if you're sure this will work, then you're free to ignore the error msg"..  I then got a runtime error when I ran ("An error occurred evaluating the Title Expression:
Expected Number, found Container.").  My expression looks like this

"This test started at "

+ RunState.Root.Locals.StartTime

I just want the time the overall sequence file began.  I want to pass this time/date down to each step (LabVIEW) that needs it (for creating similar TDM data files when necessary.

0 Kudos
Message 3 of 8
(6,155 Views)
Ryan is correct, the path is there (but at runtime only).
 
 
You are missing the "text" as the last element.  Try this:
"This test started at " + RunState.Root.Locals.StartTime.Text

Message Edited by paulmw on 07-09-2007 02:22 PM

Message Edited by paulmw on 07-09-2007 02:23 PM

Message 4 of 8
(6,151 Views)
This is exactly the type of information I need.  Is there anywhere (Reference Manual, Programmer's Guide, etc) that shows the available attributes for StartTime, StartDate, without having to run a test program and setting breakpoints?
0 Kudos
Message 5 of 8
(6,126 Views)
You just have to open your process model and look at the locals.
0 Kudos
Message 6 of 8
(6,116 Views)
That's good info Dennis.  However, a couple of things are still unclear (of course) when looking at the locals in the sequential model.  (1) Under Locals, I see StartTime, StartDate, etc.  I don't see Root.  Where does that come into play?  (2) Under ThisContext, there is also a Locals, that also has the same StartTime and StartDate.  Does it matter which is referenced, and why are there so many sets of the same data.  (3) Under RunState, there is a 'root', but it's an object reference.  Is this the 'root' of which I inquired in (1)?  If not, are these obj references intended for use by the public?
0 Kudos
Message 7 of 8
(6,108 Views)
Root refers to the execution entry point of your process model. Thus, root could be the Test UUTs or Single Pass when you use the sequential model.
0 Kudos
Message 8 of 8
(6,102 Views)