Getting current time with fractional seconds

Post beginners questions here. Don't be ashamed starting stupid topics.
Ответить
magreent
beginner
beginner
Сообщения: 14
Зарегистрирован: 19 мар 2008, 01:57
Версия LabVIEW: 7.1
Откуда: United States
Контактная информация:

Getting current time with fractional seconds

Сообщение magreent »

Hi,

I am reading data off a serial port every 5ms and together with this data I want to record the current time with fractional seconds. The code I am using is given below. I get the time in seconds and then format date/time as

%d%m%y%H%M%S%3u

The output string looks like

200308131510.412

I then us Fract/Exp String to number
The result of that is then
200308131510.4

The problem with it is I get the output only to one decimal place. How can I get around this?
Thanks.
current_time.PNG
current_time.PNG (5.41 КБ) 6688 просмотров
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: Getting current time with fractional seconds

Сообщение Eugen Graf »

You want also to see in the numeric indicator the same as in the string indicator. It's only the formatting problem of the numeric indicator. So rightklick on the indicator, and select properties. Than select the Format and Precission tab and there select floating point and 3 digits of precission.

eg
FP_Formatting.PNG
magreent
beginner
beginner
Сообщения: 14
Зарегистрирован: 19 мар 2008, 01:57
Версия LabVIEW: 7.1
Откуда: United States
Контактная информация:

Re: Getting current time with fractional seconds

Сообщение magreent »

Hi,

I do not think it's a formatting problem, I have tried the formatting and it does not help. I still get the output of the Fract/Exp to Number to only one decimal point.
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: Getting current time with fractional seconds

Сообщение Eugen Graf »

Try this VI, it should work without any problems. Or I misunderstand your issue.
Вложения
FP_Formatting.vi
(7.77 КБ) 390 скачиваний
magreent
beginner
beginner
Сообщения: 14
Зарегистрирован: 19 мар 2008, 01:57
Версия LabVIEW: 7.1
Откуда: United States
Контактная информация:

Re: Getting current time with fractional seconds

Сообщение magreent »

Hi,

The data does display well now, but then I realized a bigger problem.
When I save it to file, it does not give the same formatting and the
measurement file does not give me an option to format the data before
saving it.

If the output on the indicator is: 200308131510.412
I am getting the in the file: 2.003082E+11

I have attached the picture on the vi.

Thanks.
current_time_1.PNG
current_time_1.PNG (3.47 КБ) 6665 просмотров
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: Getting current time with fractional seconds

Сообщение Eugen Graf »

You have anyways to differ between the data in RAM and the displaying of them in a indicator or logging of this piece of RAM into a file.
Please try not to use any Express VIs, they are not so flexible as common VIs, but of course you have to decide what you take.

Also, you can take a Format Into File.VI and edit the format string like you done it in the Get Date Time String.VI
Ответить

Вернуться в «For beginners»