Lesson 3: Keeping time with TVar

Contents
  • A model of time
  • Creating a TVar
  • Setting the time
  • Invalidating the drawing area
  • Fixing the display

In the last lesson we got a basic framework up for a GTK3 app, and now we’re going to turn it into a clock. This will involve getting the time from the time library, keeping state in a TVar, and starting a thread to update the clock every second.

Sign up for access to the full page, plus the complete archive and all the latest content.