changeset 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
files MakeWaypoints.kt
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MakeWaypoints.kt	Wed Aug 25 06:33:31 2021 -0700
+++ b/MakeWaypoints.kt	Wed Aug 25 07:44:53 2021 -0700
@@ -5,9 +5,15 @@
 
 import javax.xml.stream.*
 import java.io.FileOutputStream
+import java.text.SimpleDateFormat
+import java.util.Date
+import java.util.TimeZone
 
 private const val MYNAME = "MakeWaypoints"
 private const val CHARSET = "UTF-8"
+private val WP_TIME_FORMAT = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").apply {
+   timeZone = TimeZone.getTimeZone("GMT")
+}
 
 fun main(args: Array<String>): Unit {
     if (args.size != 1) {
@@ -56,6 +62,9 @@
                 writeStartElement("wpt")
                 writeAttribute("lat", lat)
                 writeAttribute("lon", long)
+                writeStartElement("time")
+                writeCharacters(WP_TIME_FORMAT.format(Date()))
+                writeEndElement()
                 writeStartElement("name")
                 writeCharacters(name)
                 writeEndElement()