home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / apple2 / 64 < prev    next >
Encoding:
Internet Message Format  |  1991-05-03  |  3.0 KB

  1. From: jac@yoko.rutgers.edu (Jonathan A. Chandross)
  2. Newsgroups: comp.sources.apple2
  3. Subject: v001SRC045:  qtime -- Display Time In English For Orca (GS)
  4. Message-ID: <May.2.17.10.41.1991.330@yoko.rutgers.edu>
  5. Date: 2 May 91 21:10:43 GMT
  6. Approved: jac@paul.rutgers.edu
  7.  
  8.  
  9. Submitted-by: Jawaid Bazyar (bazyar@cs.uiuc.edu)
  10. Posting-number: Volume 1, Source:45
  11. Archive-name: util/gs/shell/orca/qtime
  12. Architecture: ONLY_2gs
  13. Version-number: 1.2
  14.  
  15. Display the time in English.
  16.  
  17. Requires Orca shell.
  18.  
  19. Enjoy.
  20.  
  21. ###################################
  22.  
  23. =qtime.doc
  24. -
  25. -============
  26. -    QTIME
  27. -============
  28. -
  29. -Version 1.2
  30. -
  31. -Displays time in real English, also chimes.
  32. -
  33. ------
  34. -Jawaid Bazyar
  35. -Derek Taubert
  36. -
  37. -Copyright 1990 by Procyon Software
  38. -Freeware - distribute but don't sell!
  39. -
  40. -This utility is FreeWare.  Distribute them as much as you like, just
  41. -don't sell them or distribute modified versions.  Send me your comments -
  42. -I'm eager to hear from you for suggestions and improvements.
  43. -
  44. -Also, if you make any modifications to the code please do not redistribute
  45. -them. Instead, send me the changed source along with an explanation and
  46. -I will consider including your change in the next version.
  47. -
  48. -    Jawaid Bazyar
  49. -    1120 Maple Street
  50. -    Mt. Vernon, IL 62864
  51. -
  52. -    Internet/ARPAnet     bazyar@cs.uiuc.edu
  53. -    GEnie                J.BAZYAR
  54. -
  55. -
  56. -
  57. =qtime.c
  58. -/* qtime.c      Displays time in real English, also chimes
  59. -** This version current from 18/9/89
  60. -** 02/91        Jawaid Bazyar  fixed return type and value of main
  61. -** 01/91        Derek Taubert  Few changes to port to Apple IIgs
  62. -** 09/89        Ade Lovett     Complete rewrite
  63. -** 04/86        Mark Dapoz     Converted to C for UNIX
  64. -** 12/79-12/82  Mike Cowlishaw
  65. -**
  66. -*/
  67. -#include <stdio.h>
  68. -#include <types.h>
  69. -#include <misctool.h>
  70. -
  71. -char *minutesaying[] = {
  72. -    "","just after ","a little after ","nearly ","almost "
  73. -};
  74. -char *fiveminsaying[] = {
  75. -    "","five past ","ten past ","a quarter past ","twenty past ",
  76. -    "twenty-five past ","half past ","twenty-five to ","twenty to ",
  77. -    "a quarter to ","ten to ","five to ",""
  78. -};
  79. -char *hoursaying[] = {
  80. -    "one","two","three","four","five","six","seven","eight","nine",
  81. -    "ten","eleven",""
  82. -};
  83. -
  84. -int main()
  85. -{
  86. -    char qtime[200];
  87. -    int i, hr, mn;
  88. -    TimeRec clock;
  89. -
  90. -    clock = ReadTimeHex();
  91. -    mn = clock.minute+(clock.second>29);
  92. -    hr = clock.hour+(clock.minute>32);
  93. -
  94. -    strcpy(qtime, "It's ");
  95. -    strcat(qtime, minutesaying[mn%5]);
  96. -    strcat(qtime, fiveminsaying[mn/5+(mn%5>2)]);
  97. -    
  98. -    if (hr%12) {
  99. -        strcat(qtime, hoursaying[(hr -= (hr>12)*12+1)]);
  100. -        strcat(qtime, (mn%60) ? "." : " o'clock.");
  101. -    } else {
  102. -        strcat(qtime, (hr == 12) ? "Noon." : "Midnight.");
  103. -        hr = 12;
  104. -    }
  105. -    
  106. -    if (!(mn%15))
  107. -        if (mn%60)
  108. -            printf("(Ding-Dong!)\n\n");
  109. -        else {
  110. -            printf("(");
  111. -            for (i=hr; i>=0; i--)
  112. -                printf("Bong%s",(i==0 ? "!)\n\n" : ","));
  113. -        }
  114. -    printf("%s\n",qtime);
  115. -    return 0;
  116. -}
  117. -
  118. + END OF ARCHIVE
  119.