title: How to understand offset, base, SystemClock.elapsedRealtime() when using Chronometer in Android?
body: <p>Here is the code:</p>
  <pre><code>lateinit var stopwatch: Chronometer
  var running = false
  var offset = 0L
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      stopwatch = findViewById(R.id.stopwatch)
  
      val startButton = findViewById&lt;Button&gt;(R.id.start_button)
      startButton.setOnClickListener {
          if (!running) {
              stopwatch.base = SystemClock.elapsedRealtime() - offset
              stopwatch.start()
              running = true
          }
      }
  
      val pauseButton = findViewById&lt;Button&gt;(R.id.pause_button)
      pauseButton.setOnClickListener {
          if (running) {
              stopwatch.stop()
              running = false
              offset = SystemClock.elapsedRealtime() - stopwatch.base
          }
      }
  
      val resetButton = findViewById&lt;Button&gt;(R.id.reset_button)
      resetButton.setOnClickListener {
          offset = 0L
          stopwatch.base = SystemClock.elapsedRealtime()
      }
  }
  </code></pre>
  <ol>
  <li>What is the meaning of base? Is it similar to text property in TextView?</li>
  <li>How to understand SystemClock.elapsedRealtime(), why &quot;stopwatch.base = SystemClock.elapsedRealtime()&quot; means resetting the stopwatch?</li>
  <li>Why we need the variable offset, what does it mean?</li>
  </ol>
  <p>Could someone tell me about the rationale behind it? I have searched a lot of answers and still can't understand.</p>