Mercurial > cgi-bin > hgweb.cgi > TopoTiler
comparison MakeWaypoints.kt @ 5:a725bd48bc0b
Time stamp all waypoints.
author | David Barts <n5jrn@me.com> |
---|---|
date | Wed, 25 Aug 2021 07:44:53 -0700 |
parents | 45be2d1d3213 |
children | cd32e08fa37f |
comparison
equal
deleted
inserted
replaced
4:45be2d1d3213 | 5:a725bd48bc0b |
---|---|
3 * way to write XML. | 3 * way to write XML. |
4 */ | 4 */ |
5 | 5 |
6 import javax.xml.stream.* | 6 import javax.xml.stream.* |
7 import java.io.FileOutputStream | 7 import java.io.FileOutputStream |
8 import java.text.SimpleDateFormat | |
9 import java.util.Date | |
10 import java.util.TimeZone | |
8 | 11 |
9 private const val MYNAME = "MakeWaypoints" | 12 private const val MYNAME = "MakeWaypoints" |
10 private const val CHARSET = "UTF-8" | 13 private const val CHARSET = "UTF-8" |
14 private val WP_TIME_FORMAT = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").apply { | |
15 timeZone = TimeZone.getTimeZone("GMT") | |
16 } | |
11 | 17 |
12 fun main(args: Array<String>): Unit { | 18 fun main(args: Array<String>): Unit { |
13 if (args.size != 1) { | 19 if (args.size != 1) { |
14 System.err.println("${MYNAME}: expecting a single file name") | 20 System.err.println("${MYNAME}: expecting a single file name") |
15 System.exit(2) | 21 System.exit(2) |
54 continue | 60 continue |
55 } | 61 } |
56 writeStartElement("wpt") | 62 writeStartElement("wpt") |
57 writeAttribute("lat", lat) | 63 writeAttribute("lat", lat) |
58 writeAttribute("lon", long) | 64 writeAttribute("lon", long) |
65 writeStartElement("time") | |
66 writeCharacters(WP_TIME_FORMAT.format(Date())) | |
67 writeEndElement() | |
59 writeStartElement("name") | 68 writeStartElement("name") |
60 writeCharacters(name) | 69 writeCharacters(name) |
61 writeEndElement() | 70 writeEndElement() |
62 writeEndElement() | 71 writeEndElement() |
63 } | 72 } |