Show database ready time in debug info.

This commit is contained in:
voussoir 2023-11-30 17:38:23 -08:00
parent c6a0212fb8
commit 0fc6971d9d
2 changed files with 4 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import java.io.File
class Database(val trackbook: Trackbook) class Database(val trackbook: Trackbook)
{ {
var ready: Boolean = false var ready: Boolean = false
var ready_at: Long = 0
lateinit var file: File lateinit var file: File
lateinit var connection: SQLiteDatabase lateinit var connection: SQLiteDatabase
@ -16,6 +17,7 @@ class Database(val trackbook: Trackbook)
{ {
this.connection.close() this.connection.close()
this.ready = false this.ready = false
this.ready_at = 0
this.trackbook.call_database_changed_listeners() this.trackbook.call_database_changed_listeners()
} }
@ -26,6 +28,7 @@ class Database(val trackbook: Trackbook)
this.connection = openOrCreateDatabase(file, null) this.connection = openOrCreateDatabase(file, null)
this.initialize_tables() this.initialize_tables()
this.ready = true this.ready = true
this.ready_at = System.currentTimeMillis()
Log.i("VOUSSOIR", "Database.open: Calling all listeners") Log.i("VOUSSOIR", "Database.open: Calling all listeners")
} }

View file

@ -670,6 +670,7 @@ class MapFragment : Fragment()
state: ${state_name()} state: ${state_name()}
clock: ${iso8601_local_noms(System.currentTimeMillis())} clock: ${iso8601_local_noms(System.currentTimeMillis())}
location: ${iso8601_local_noms(tracker.currentBestLocation.time)} location: ${iso8601_local_noms(tracker.currentBestLocation.time)}
database: ${iso8601_local_noms(trackbook.database.ready_at)}
listeners: ${iso8601_local_noms(tracker.listeners_enabled_at)} listeners: ${iso8601_local_noms(tracker.listeners_enabled_at)}
motion: ${iso8601_local_noms(tracker.last_significant_motion)} motion: ${iso8601_local_noms(tracker.last_significant_motion)}
watchdog: ${iso8601_local_noms(tracker.last_watchdog)} watchdog: ${iso8601_local_noms(tracker.last_watchdog)}