Skip to content

Instantly share code, notes, and snippets.

@mvexel
Created May 7, 2014 16:49
Show Gist options
  • Save mvexel/f8cc1ec715f98b6e5d22 to your computer and use it in GitHub Desktop.
Save mvexel/f8cc1ec715f98b6e5d22 to your computer and use it in GitHub Desktop.
def get_changeset_path_for(utctime):
import os
parts = ["http://planet.osm.org/replication/changesets/"]
from math import floor
minutes = int(floor((utctime - config.OSM_DAY_ZERO).total_seconds() / 60))
rem = minutes
while rem > 0:
parts.append(str(rem % 1000).zfill(3))
rem = (rem - rem % 1000) / 1000
return os.path.join(*parts)
@mvexel
Copy link
Author

mvexel commented May 7, 2014

Where

OSM_DAY_ZERO = datetime.datetime(2012, 10, 28, 19, 36, tzinfo=tzutc())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment