From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error of Get date/time in seconds function

Hi, I want to save mili second time in text file.

 

I make VI and attach my VI.

 

My Vi receive data every 2ms.

 

But, time stamp is not saved every 2ms.

 

I attach my data file. why is this error occur?

Download All
0 Kudos
Message 1 of 15
(3,780 Views)

Hi Sangkyu,

 

that's how you calculate your "timestamp":

check.png

From timestamp (in seconds since 1.1.1900) you subtract an arbitrary number, then you multiply by 1000 (to convert to milliseconds?), then round down to nearest.

But in your datafile you get numbers like "1501773199168.680660"!? Why do you save the timestamp with format "%f", when you round to nearest? Why are there fractions at all, when you used round to nearest?

 

Beside these questions: GetDateTimeInSeconds uses the system clock and depends on the resolution of the system clock. Windows used to use a resolution of 15ms in ancient versions, now it uses 1ms.

Are you sure you get a new value each 2ms? Just transfering 17 bytes at 115.2kbaud takes 1.5ms - without any processing overhead…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 15
(3,761 Views)

I save the mili second time due to synchronize with android smart phone.

 

Android system time since 1940 years so i subtract  2082812409 and

 

multiply 1000 for mili second scale.

 

I don't need below mili second scale, so i round my time stamp.

 

I test my system send 2ms well.

 

My desktop OS is window 7.

 

System clock of Win 7 is 15ms?

 

Is this occur error saving mili second scale?

 

I have Win 10 laptop.

 

In Win 10 system, Time stamp save every 1ms?

0 Kudos
Message 3 of 15
(3,757 Views)

Hi Sangkyu,

 

the timestamps in your file show this:

1501773199169.68

1501773199170.68

1501773199171.68

They differ by 1ms - the resolution of the windows timer…

 

Apart from rounding issue: what exactly is your problem now?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 15
(3,745 Views)

In my file

 

Saved data is

1501773199169.68

1501773199169.68

1501773199169.68

1501773199169.68

1501773199169.68

1501773199169.68

1501773199169.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199170.68

1501773199171.68

1501773199171.68

1501773199171.68

1501773199171.68

1501773199171.68

1501773199171.68

1501773199171.68

.

.

.

 

actually, the time will save 2ms interval....

 

0 Kudos
Message 5 of 15
(3,737 Views)

Hi Sangkyu,

 

actually, the time will save 2ms interval....

No. You get 69, 70, 71 - each millisecond some messages…

The problem is: you get ~10 messages per millisecond!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 15
(3,730 Views)

I make VI which is receive by VISA.

 

I send data every 2ms.

 

My data is 10 Channel , Fs=500Hz, T=1.024s square wave.

 

The data length calculate in Mathlab, is 10.442 sec.

L=5222(number of data) 

 T=1/Fs;
t=(L-1)*T;

 

But, The timestamp which 'Get date/time in seconds function'  in Labview  is 9.316740478515625sec

The value was Last Value - first Value of time stamp.

 

I think data of 'Get date/time in seconds function' is saved every 2ms, but the saved data is very strange.

The same data is stored multiple times.

 

I test this VI both Win7 PC and Win 10 PC.

 

Why 'Get date/time in seconds function' not return the value at every while loop?

 

I attach my VI and data file.

0 Kudos
Message 7 of 15
(3,743 Views)

any difference to your other post?

https://forums.ni.com/t5/LabVIEW/Error-of-Get-date-time-in-seconds-function/td-p/3669957


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 8 of 15
(3,734 Views)

Attached data file is different.

 

I think that this data file will explain my problem well.

0 Kudos
Message 9 of 15
(3,729 Views)

can't open your vi, i guess because of the "strange" characters.

please use only ASCII in filenames since it saves a lot of trouble.


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 10 of 15
(3,726 Views)