Skip to content

Instantly share code, notes, and snippets.

@iani
Created February 8, 2019 17:09
Show Gist options
  • Select an option

  • Save iani/6a2de34e2639eb552d3a2a13e595b0de to your computer and use it in GitHub Desktop.

Select an option

Save iani/6a2de34e2639eb552d3a2a13e595b0de to your computer and use it in GitHub Desktop.
compmus class session 7 sc code - clock
\clock.class;
'clock'.class;
Date.localtime - Date.localtime;
//:
\clock.window({ | w |
var routine, beats = 0, textdisplay, minutes, seconds;
w.view.layout = VLayout(
textdisplay = StaticText().string_("CLOCK IS HERE"),
seconds = NumberBox(),
minutes = NumberBox()
);
routine = {
loop {
1.wait;
beats = beats + 1;
seconds.value = beats % 60;
minutes.value = beats - (beats % 60) / 60;
textdisplay.string = Date.localtime.stamp[9..];
}
}.fork(AppClock);
});
//:
Date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment