Date conversion bug

“Unix Time” to “Rata Die” conversion that takes place here

is wrong because “Rata Die” epoch starts at 1, not at zero. Add one and it is correct.

The comment above that line is wrong. Should be days not hours.

Below is a python command line session that hopefully explains why this is wrong

from time import time
from datetime import datetime
from matplotlib.dates import date2num
t = time()
t / (24. * 3600) +719162 - date2num(datetime.fromtimestamp(t))
-1.0

Regards,
Olafur St. Arnarsson

Veðurstofa Íslands | Icelandic Met Office
Bústaðavegur 7-9, 150 Reykjavík
Sími +354 522 6000
www.vedur.is | en.vedur.is

E-mail Disclaimer

Hi Olafur,

thanks for the report. I opened an issue on GitHub to track and fix the bug:
https://github.com/obspy/obspy/issues/870

Cheers!

Lion