Skip to content

Instantly share code, notes, and snippets.

@alexeyshockov
Created June 13, 2017 21:25
Show Gist options
  • Save alexeyshockov/45c0a3718f0e2bd1e5b238a515d86555 to your computer and use it in GitHub Desktop.
Save alexeyshockov/45c0a3718f0e2bd1e5b238a515d86555 to your computer and use it in GitHub Desktop.
#!/usr/bin/env php
<?php
$file = $argv[1];
$date = (new DateTime())->modify('-1 day');
$doc = new SimpleXMLElement(file_get_contents($file));
foreach ($doc->trk->trkseg->children() as $k => $trkpt) {
$trkpt->time = $date->format('Y-m-d\TH:i:s\Z');
$date = $date->modify('+1 second');
}
// Output can be redirected by the user.
echo $doc->asXML();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment