Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2616

Re: Convert timestamp to elapsed time

Newsgroups comp.graphics.apps.gnuplot
Date 2014-10-14 07:19 -0700
References <m00emp$fe5$1@dont-email.me>
Message-ID <497602c1-b3ac-42db-8d04-a2e79bc6a256@googlegroups.com> (permalink)
Subject Re: Convert timestamp to elapsed time
From Kalin Kozhuharov <me.kalin@gmail.com>

Show all headers | View raw


On Thursday, September 25, 2014 4:02:49 PM UTC+9, Michael Okuntsov wrote:
> how to convert timestamp values like
> 2014-09-25_14:01:23.576
> to number of seconds since the first value in file?
>
I guess you mean on-the-fly...

1. split the problem
* convert a value to something easy to work with (e.g. something like unix timestamp + ns:  date --date="2014-09-25T14:01:23.576" +%s.%N --> 1411621283.576000000); define function (call it T2sec) to do it
* read the first line (use head) and store it in variable (say T0)
* plot "file" u (T2sec($1) - T0):2 w lp

** you'll need to replace "_" with "T" for date to work as above

Alternatively write a small perl script to filter the input.

Cheers,
Kalin.

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Convert timestamp to elapsed time Michael Okuntsov <proximum@land.ru> - 2014-09-25 14:02 +0700
  Re: Convert timestamp to elapsed time Kalin Kozhuharov <me.kalin@gmail.com> - 2014-10-14 07:19 -0700

csiph-web