LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

strange behavior from timestamp

"15 math functions" is, perhaps, a slight exaggeration, don't you think?
 
I don't use the "format date/time string" function because it doesn't give me the exact format that I need to display.  The "scan from string" function does.  And yes, the format of the string displayed on the front panel does matter in this case.
 
You are right about the "first call" function.  That is a leftover from the original code that I borrowed -- I intended to take it out since it was no longer needed, but I was in a hurry and neglected to do so.
 
It seems that I misunderstood how shift registers function.  I had understood that if one initialized a shift register, it would initialize every time the subVI was called.  If one did not initialize a shift register, it would retain its value from the previous subVI call.  I thought that initializing the shift register using the "get time in sec" function would ensure that I got a new timestamp every time I called the subVI.  Apparently not. 
 
And finally, there will be times when I need to display and track milliseconds.  It doesn't happen in this particular piece of code, but it will in future.
 
Thanks for the input!  🙂
 
0 Kudos
Message 11 of 15
(775 Views)
You did not misunderstand how shift registers work. That is precisely how they work. Jeff is pointing out that when you're inside the loop you're operating relative to the initial time. Since you're adding tickcounts, it doesn't matter if you change the system clock during this time. Once you run the VI again, it picks up the new time and runs based off of that.
0 Kudos
Message 12 of 15
(760 Views)

Yes...I see that would be true while "Time stamper" is executing.  However...

Inside the main program, as you can see from an earlier post, I have a while loop which tracks the time and displays it on the front panel.  In that while loop, "Time stamper" is not run continuously.  It runs it for one second and then exits, the loop iterates, it runs it again, the loop iterates, etc.

Each time the while loop in the main program calls "Time stamper", the shift register in "time stamper" should initialize to the current computer time, since the "Get time in seconds" function is called and the output of that function is used to initialize the shift register.  Right?

I am finding that it does not.

So, I see what you're all saying, and the behavior would indeed make sense if "Time stamper" was running continuously, but I think you might be losing sight of the fact that the main program enters and exits "Time stamper" every second -- so that shift register should be re-initializing for each call of the subroutine. 

Thanks!

0 Kudos
Message 13 of 15
(728 Views)
I am simply not seeing the behavior that you're describing. I don't have a DAQ system, so I had to disable all the DAQ stuff, but running your VI I changed the system clock, and the time display on the front panel changed to reflect this (after the delay).

As an aside: In the "Time Stamper" VI the shift registers are useless. They perform no function since the shift register value is never changed. You can replace them with tunnels and the VI will work in exactly the same way.
0 Kudos
Message 14 of 15
(720 Views)

Well, that's curious.  Must be something weird about this particular computer, then, because it doesn't when I do it.

In a previous incarnation of this particular subroutine, the shift registers were useful.  You are right that I could take them out now.

Thanks again!

0 Kudos
Message 15 of 15
(707 Views)