'*********************************************************************** ' Time.Bas uses QTimer and QLabel to update and display the hour and ' minutes in the program. ' timelord@zebra.net '*********************************************************************** Declare Function TheTimeIs (hrs%, min%) as String Declare Sub QTimer1 Create Timer1 as QTimer Interval=500 Enabled=1 OnTimer=QTimer1 End Create Create Form as QForm Caption = "Time.Bas" Create StatusBar as QStatusBar AddPanels "","","" End Create Create clock as QLabel Top=10: Left=10 End Create ShowModal End Create '--------------------------------------------------------------------- Sub QTimer1 Timer1.Interval = 500 I = I + 1 hrs% = val(Left$(Time$,2)) min% = val(Mid$(Time$, 4,2)) IF temp% <> min% Then clock.Caption = "The time is " + TheTimeIs (hrs%, min%) temp% = min% End if End Sub Function TheTimeIs (hrs%,min%) m$ = " am": min$ = ":" + Str$(min%) If hrs% > 12 then hrs% = hrs% - 12: m$ = " pm" End if If hrs% = 0 then hrs% = 12 end if If min% < 10 then min$ = ":0" + str$(min%) end if TheTimeIs = str$(hrs%) + min$ + m$ End Function