LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

number of seconds since midnight

Solved!
Go to solution
Solution
Accepted by psuedonym

@Mancho00 wrote:

I love crossrulz's solution, but have to adjust for current timezone.  Or just do this.

seconds today.png


 I think my solution is cleaner if you would rather calculate it and not worry abut time zones

 

Seconds.png

========================
=== Engineer Ambiguously ===
========================
Message 21 of 28
(982 Views)

@RTSLVU wrote:

My solution is cleaner if you would rather calculate it and not worry abut time zones

 

Seconds.png


You forgot the Fractional Seconds.  Also, this is where the Compound Arithmetic node can help (expand to 4 inputs in the Add mode).

 

EDIT: Oh, and this will probably still break on the days DST is started and ended.  I would have to figure out what day that is in order to give it a try...But I am past time to go home.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 22 of 28
(976 Views)

I learned a lot. Had not used LabVIEW's timestamp very much in the past.

 

Thanks again.

0 Kudos
Message 23 of 28
(968 Views)

@crossrulz wrote:

@RTSLVU wrote:

My solution is cleaner if you would rather calculate it and not worry abut time zones

 


You forgot the Fractional Seconds.  Also, this is where the Compound Arithmetic node can help (expand to 4 inputs in the Add mode).

 

EDIT: Oh, and this will probably still break on the days DST is started and ended.  I would have to figure out what day that is in order to give it a try...But I am past time to go home.


Actually I had the fractional seconds in there to begin with but took it out as I don't think the VB function the OP was trying to duplicate returns fractional seconds.

 

Interesting thought about DST start and end days... 

 

But that is what UTC is for after all 😛 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 24 of 28
(965 Views)

Also I am going to toss this out there just in case you notice there is a difference between LabVIEW and VB.NET raw timestamps...

 

 

The OLE (Windows, Excel, etc) date format is a double-precision floating point number that counts the time from 30 December 1899 00:00:00.

(Epoch 0 December 1899 00:00:00)

 

The UTC date that is returned from the LabVIEW functions is the number of seconds elapsed since 12:00 a.m., Friday, January 1, 1904.

(Epoch 12:00 a.m., Friday, January 1, 1904)

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 25 of 28
(961 Views)

@RTSLVU wrote:

Interesting thought about DST start and end days... 

 

But that is what UTC is for after all 😛 


Indeed.  And one of the reasons I use UTC as the time zone on all of my test systems.

 

"Sea" story:

I inherited a system that was doing thermal cycles and it used the system time for calculating the soak times.  DST kicked in during said soak time.  Confusion insued when the thermal charts showed an extra hour of soaking.  It took them several days before realizing DST was the cause.  Their fix was to not test on the weekends DST transitioned.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 26 of 28
(920 Views)

For the purpose of number of seconds since midnight I do not think there will be issues an the LV logic will handle that without an issues.

 

The complication with DST is when we try to turn the seconds since 1904 into a time like 2:00 AM.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 27 of 28
(903 Views)

@crossrulz wrote:

"Sea" story:

I inherited a system that was doing thermal cycles and it used the system time for calculating the soak times.  DST kicked in during said soak time.  Confusion insued when the thermal charts showed an extra hour of soaking.  It took them several days before realizing DST was the cause.  Their fix was to not test on the weekends DST transitioned.


OMG! That's funny...

Patient: Doctor, it hurts when I do this.

Doctor: Then don't do that.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 28 of 28
(887 Views)