LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

number of seconds since midnight

Solved!
Go to solution
Highlighted
Solution
Accepted by topic author 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

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 21 of 28
(276 Views)
Highlighted

@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
0 Kudos
Message 22 of 28
(270 Views)
Highlighted

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

 

Thanks again.

0 Kudos
Message 23 of 28
(262 Views)
Highlighted

@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 😛 

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 24 of 28
(259 Views)
Highlighted

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)

 

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 25 of 28
(255 Views)
Highlighted

@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
0 Kudos
Message 26 of 28
(214 Views)
Highlighted

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
(197 Views)
Highlighted

@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.

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 28 of 28
(181 Views)