home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-05 | 1.6 KB | 57 lines | [TEXT/MPS ] |
- #
- # File: Time.vu
- #
- # Contains: Tasks that make it easier to work with time in VU.
- #
- # Written by: Sean Flynn
- #
- # Copyright: © 1990 by Apple Computer, Inc., all rights reserved.
- #
- #
- #
-
-
- # *****************************************************************************************
- task wait_for_time( end_hour := 0, end_minute := 0, end_second := 0 )
- # Wait_for_time task. Wait until a specified time of day.
- begin
- while match[time h:?h2 s:?s2] and
- ( h2 / 100 <> end_hour or
- h2 mod 100 < end_minute or
- s2 < end_second ) do;
- end;
-
-
- # *****************************************************************************************
- task print_current_time(print_date := true) begin
- # This task pretty prints the current time. The format is as follows:
- # <hour of day>:<minutes>:<seconds> <AM or PM>
- # It also takes one parameter that indicates whether the date should be printed.
- # If the actual parameter passed is a true value, the current date is also printed.
- # If no parameter is passed, the date is printed by default.
- # The format of the date is as follows:
- # <month>/<day>/<year>
- #
- match [time h:?hour s:?secs d:?day m:?month y:?year];
- hour_of_day := hour / 100;
- if(hour < 1200) begin # in AM
- if(hour_of_day) print hour_of_day;
- else print '12';
- meridian := ' AM';
- end;
- else begin # in PM
- if hour_of_day = 12 print hour_of_day;
- else print hour_of_day - 12;
- meridian := ' PM';
- end;
- print ':',(hour mod 100) / 10,(hour mod 10),':',secs;
- print meridian;
- if(print_date) begin
- print " ",month,"/",day,"/",(year mod 100) / 10,(year mod 10);
- end;
- end;
-
-
- (* Example Usage:
- print_current_time(true);
- *)