home *** CD-ROM | disk | FTP | other *** search
- From: jac@yoko.rutgers.edu (Jonathan A. Chandross)
- Newsgroups: comp.sources.apple2
- Subject: v001SRC045: qtime -- Display Time In English For Orca (GS)
- Message-ID: <May.2.17.10.41.1991.330@yoko.rutgers.edu>
- Date: 2 May 91 21:10:43 GMT
- Approved: jac@paul.rutgers.edu
-
-
- Submitted-by: Jawaid Bazyar (bazyar@cs.uiuc.edu)
- Posting-number: Volume 1, Source:45
- Archive-name: util/gs/shell/orca/qtime
- Architecture: ONLY_2gs
- Version-number: 1.2
-
- Display the time in English.
-
- Requires Orca shell.
-
- Enjoy.
-
- ###################################
-
- =qtime.doc
- -
- -============
- - QTIME
- -============
- -
- -Version 1.2
- -
- -Displays time in real English, also chimes.
- -
- ------
- -Jawaid Bazyar
- -Derek Taubert
- -
- -Copyright 1990 by Procyon Software
- -Freeware - distribute but don't sell!
- -
- -This utility is FreeWare. Distribute them as much as you like, just
- -don't sell them or distribute modified versions. Send me your comments -
- -I'm eager to hear from you for suggestions and improvements.
- -
- -Also, if you make any modifications to the code please do not redistribute
- -them. Instead, send me the changed source along with an explanation and
- -I will consider including your change in the next version.
- -
- - Jawaid Bazyar
- - 1120 Maple Street
- - Mt. Vernon, IL 62864
- -
- - Internet/ARPAnet bazyar@cs.uiuc.edu
- - GEnie J.BAZYAR
- -
- -
- -
- =qtime.c
- -/* qtime.c Displays time in real English, also chimes
- -** This version current from 18/9/89
- -** 02/91 Jawaid Bazyar fixed return type and value of main
- -** 01/91 Derek Taubert Few changes to port to Apple IIgs
- -** 09/89 Ade Lovett Complete rewrite
- -** 04/86 Mark Dapoz Converted to C for UNIX
- -** 12/79-12/82 Mike Cowlishaw
- -**
- -*/
- -#include <stdio.h>
- -#include <types.h>
- -#include <misctool.h>
- -
- -char *minutesaying[] = {
- - "","just after ","a little after ","nearly ","almost "
- -};
- -char *fiveminsaying[] = {
- - "","five past ","ten past ","a quarter past ","twenty past ",
- - "twenty-five past ","half past ","twenty-five to ","twenty to ",
- - "a quarter to ","ten to ","five to ",""
- -};
- -char *hoursaying[] = {
- - "one","two","three","four","five","six","seven","eight","nine",
- - "ten","eleven",""
- -};
- -
- -int main()
- -{
- - char qtime[200];
- - int i, hr, mn;
- - TimeRec clock;
- -
- - clock = ReadTimeHex();
- - mn = clock.minute+(clock.second>29);
- - hr = clock.hour+(clock.minute>32);
- -
- - strcpy(qtime, "It's ");
- - strcat(qtime, minutesaying[mn%5]);
- - strcat(qtime, fiveminsaying[mn/5+(mn%5>2)]);
- -
- - if (hr%12) {
- - strcat(qtime, hoursaying[(hr -= (hr>12)*12+1)]);
- - strcat(qtime, (mn%60) ? "." : " o'clock.");
- - } else {
- - strcat(qtime, (hr == 12) ? "Noon." : "Midnight.");
- - hr = 12;
- - }
- -
- - if (!(mn%15))
- - if (mn%60)
- - printf("(Ding-Dong!)\n\n");
- - else {
- - printf("(");
- - for (i=hr; i>=0; i--)
- - printf("Bong%s",(i==0 ? "!)\n\n" : ","));
- - }
- - printf("%s\n",qtime);
- - return 0;
- -}
- -
- + END OF ARCHIVE
-