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


Groups > comp.graphics.apps.gnuplot > #2597 > unrolled thread

Convert timestamp to elapsed time

Started byMichael Okuntsov <proximum@land.ru>
First post2014-09-25 14:02 +0700
Last post2014-10-14 07:19 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  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

#2597 — Convert timestamp to elapsed time

FromMichael Okuntsov <proximum@land.ru>
Date2014-09-25 14:02 +0700
SubjectConvert timestamp to elapsed time
Message-ID<m00emp$fe5$1@dont-email.me>
Hello,

how to convert timestamp values like

2014-09-25_14:01:23.576

to number of seconds since the first value in file?

[toc] | [next] | [standalone]


#2616

FromKalin Kozhuharov <me.kalin@gmail.com>
Date2014-10-14 07:19 -0700
Message-ID<497602c1-b3ac-42db-8d04-a2e79bc6a256@googlegroups.com>
In reply to#2597
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web