]> git.openstreetmap.org Git - nominatim.git/blob - utils/osm_file_date.py
move website settings back to settings/
[nominatim.git] / utils / osm_file_date.py
1 #!/usr/bin/env python3
2
3 import osmium
4 import sys
5 import datetime
6
7
8 class Datecounter(osmium.SimpleHandler):
9
10     filedate = None
11
12     def date(self, o):
13         ts = o.timestamp
14         if self.filedate is None or ts > self.filedate:
15             self.filedate = ts
16
17     node = date
18     way = date
19     relation = date
20
21
22 if __name__ == '__main__':
23     if len(sys.argv) != 2:
24         print("Usage: python osm_file_date.py <osmfile>")
25         sys.exit(-1)
26
27     h = Datecounter()
28
29     h.apply_file(sys.argv[1])
30
31     if h.filedate is None:
32         exit(5)
33
34     print(h.filedate)