# obspy.io.mseed.util.shift_time_of_file

`shift_time_of_file`(input_file, output_file, timeshift)

  Takes a MiniSEED file and shifts the time of every record by the given amount.

  The same could be achieved by reading the MiniSEED file with ObsPy, modifying the starttime and writing it again. The problem with this approach is that some record specific flags and special blockettes might not be conserved. This function directly operates on the file and simply changes some header fields, not touching the rest, thus preserving it.

  Will only work correctly if all records have the same record length which usually should be the case.

  All times are in 0.0001 seconds, that is in 1/10000 seconds. NOT ms but one order of magnitude smaller! This is due to the way time corrections are stored in the MiniSEED format.

  Parameters: | input_file (str) The input filename. output_file (str) The output filename. timeshift (int) The time-shift to be applied in 0.0001, e.g. 1E-4 seconds. Use an integer number.

  Please do NOT use identical input and output files because if something goes wrong, your data WILL be corrupted/destroyed. Also always check the resulting output file.

  Technical details

  The function will loop over every record and change the “Time correction” field in the fixed section of the MiniSEED data header by the specified amount. Unfortunately a further flag (bit 1 in the “Activity flags” field) determines whether or not the time correction has already been applied to the record start time. If it has not, all is fine and changing the “Time correction” field is enough. Otherwise the actual time also needs to be changed.

  One further detail: If bit 1 in the “Activity flags” field is 1 (True) and the “Time correction” field is 0, then the bit will be set to 0 and only the time correction will be changed thus avoiding the need to change the record start time which is preferable.

### Thank you!

We would like to thank our contributors, whose efforts make this software what it is. These people have helped by writing code and documentation, and by testing. They have created and maintained this product, its associated libraries and applications, our build tools and our web sites.

#### Contributors

- Ackerley, Nick
- Allgeyer, Sebastien
- Ammon, Charles J.
- Antunes, Emanuel
- Arnarsson, Ólafur St.
- Bank, Markus
- Barsch, Robert
- Behr, Yannik
- Bernardi, Fabrizio
- Bernauer, Felix
- Bes de Berc, Maxime
- Beyreuther, Moritz
- Boltz, Shawn
- Bonaimé, Sébastien
- Carothers, Lloyd
- Chamberlain, Calum
- Chambers, Derrick
- Chen, Zhao
- Clark, Adam
- Danecek, Peter
- Egdorf, Sven
- Engels, Fabian
- Ermert, Laura
- Eulenfeld, Tom

- Fabbri, Tommaso
- Falco, Nicholas
- Fee, Jeremy
- Grellier, Clément
- Grunberg, Marc
- Hammer, Conny
- Heimann, Sebastian
- Heiniger, Lukas
- Hope, Gaute
- Igel, Heiner
- Inza, Adolfo
- Isken, Marius
- Ketchum, David
- Koymans, Mathijs
- Kremers, Simon
- Kress, Victor
- Krieger, Lars
- Krischer, Lion
- Kula, Damian
- Käufl, Paul
- Köhler, Andreas
- Lecocq, Thomas
- Leeman, John
- Legovini, Paride

- Lesage, Philippe
- Li, Yulin
- Lomax, Anthony
- Lopes, Rui L.
- MacCarthy, Jonathan
- Maggi, Alessia
- Martin, Henri
- Medlin, Andrew
- Megies, Tobias
- Meschede, Matthias
- Michelini, Alberto
- Miller, Nathaniel C.
- Morgenstern, Bernhard
- Nof, Ran Novitsky
- Panning, Mark P.
- Parker, Tom
- Pestourie, Romain
- Rapagnani, Giovanni
- Reyes, Celso
- Ringler, Adam
- Rothenhäusler, Nicolas
- Russo, Emiliano
- Sales de Andrade, Elliott

- Satriano, Claudio
- Saul, Joachim
- Scheingraber, Chris
- Schneider, Simon
- Sippl, Christian
- Snoke, Arthur
- Stange, Stefan
- Stähler, Simon C.
- Sullivan, Benjamin
- Tian, Dongdong
- Trabant, Chad
- Trani, Luca
- Uieda, Leonardo
- Walker, Andrew
- Walther, Marcus
- Wassermann, Joachim
- Williams, Mark C.
- Winkelman, Andrew
- Zaccarelli, Riccardo
- Zad, Seyed Kasra Hosseini
- Zhu, Lijun
- van Driel, Martin
- van Wijk, Kasper

#### Funds

ObsPy was partially funded by the

- German Science Foundation (DFG) via grant DFG IG 16/9-1
- German Ministry for Education and Research (BMBF), GEOTECHNOLOGIEN grant 03G0646H.
- NERA project (Network of European Research Infrastructures for Earthquake Risk Assessment and Mitigation) under the European Community's Seventh Framework Programme (FP7/2007-2013) grant agreement n° 262330
- Leibniz Institute for Applied Geophysics (LIAG)
- VERCE EU-FP7 project (no. 283543)