Created
May 7, 2014 16:49
-
-
Save mvexel/f8cc1ec715f98b6e5d22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where
OSM_DAY_ZERO = datetime.datetime(2012, 10, 28, 19, 36, tzinfo=tzutc())