home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / QHEURE.ZIP / QHEURE.CMD
OS/2 REXX Batch file  |  1991-07-06  |  3KB  |  123 lines

  1. /* Displays time in French, also chimes.               */
  2. /* From QTIME, Mike Cowlishaw,  December 1979          */
  3. /* Xavier de Lamberterie, Janvier 1982                 */
  4.  
  5. arg arg deb
  6. if arg=?
  7.    then call tell
  8. if arg='STACK'
  9.    then do
  10.       stack=1
  11.       parse var deb arg deb
  12.       end
  13.    else stack=0
  14. if arg='TEST'
  15.    then c8=deb
  16.    else do
  17.       if deb <>  '' then trace ?r
  18.       c8=time()
  19.       end
  20. ot="Il est"
  21. hr=substr(c8,1,2)+0
  22. mn=substr(c8,4,2)
  23. sc=substr(c8,7,2)
  24.  
  25. h.0 = 'minuit'
  26. h.1 = 'une' ; h.2 = 'deux';    h.3 = 'trois';   h.4 = 'quatre'
  27. h.5 = 'cinq'; h.6 = 'six' ;    h.7 = 'sept' ;   h.8 = 'huit'
  28. h.9 = 'neuf'; h.10= 'dix' ;    h.11= 'onze' ;   h.12= 'midi'
  29.  
  30. if sc>29
  31.    then mn=mn+1                                       /* round up mins */
  32. if mn>32
  33.    then do;                                          /* something to.. */
  34.         hr=hr+1
  35.         end;
  36. if hr>=24
  37.    then hr=hr-24                                     /* watch for 25 h */
  38. if hr>12
  39.    then hr=hr-12                           /* get rid of 24-hour clock */
  40. if hr <> 0 & hr<>12
  41.    then do;
  42.         if hr=1
  43.         then h.hr=h.hr 'heure'     /* ajoute heure sauf a midi/minuit */
  44.         else h.hr=h.hr 'heures'    /* ajoute heure sauf a midi/minuit */
  45.         end;
  46.  
  47. mod=mn//5
  48.  
  49. select
  50.    when mod=0 then xt=''                                      /* exact */
  51.    when mod=1 then xt='legerement passe'
  52.    when mod=2 then xt='passe'
  53.    when mod=3 then xt='bientot'
  54.    when mod=4 then xt='presque'
  55.    end                                                       /* select */
  56.  
  57. mn=mn+2                                                    /* round up */
  58. mn=mn-(mn//5)                                     /* to nearest 5 mins */
  59.  
  60. select
  61.    when mn=0  then yt=''
  62.    when mn=60 then do; mn=0; yt=''; end;
  63.    when mn= 5 then yt='cinq'
  64.    when mn=10 then yt='dix'
  65.    when mn=15 then yt='et quart'
  66.    when mn=20 then yt='vingt'
  67.    when mn=25 then yt='vingt cinq'
  68.    when mn=30 then yt='et demie'
  69.    when mn=35 then yt='moins vingt cinq'
  70.    when mn=40 then yt='moins vingt'
  71.    when mn=45 then yt='moins le quart'
  72.    when mn=50 then yt='moins dix'
  73.    when mn=55 then yt='moins cinq'
  74.    end
  75. if mod=0
  76.    then if mn=0
  77.         then ot=ot h.hr;
  78.         else ot=ot h.hr yt;
  79.    else if mod<3
  80.            then if yt='' then ot=ot h.hr xt;
  81.                          else ot=ot h.hr yt xt;
  82.            else if yt='' then ot=ot xt h.hr;
  83.                          else ot=ot xt h.hr yt;
  84. ot=ot'.'
  85. if \stack
  86.    then do
  87.       if mod=0 & mn//15=0
  88.          then call chime
  89.       say
  90.       say ot
  91.       say
  92.       end
  93.    else push ot
  94. exit
  95.  
  96. chime:                                                  /* Give chimes */
  97. if mn//60=0
  98.    then do
  99.       chime='Dong'
  100.       num=hr
  101.       if num=0 then num=12
  102.       end
  103.    else do                                                  /* quarter */
  104.       chime='Ding-Dong'
  105.       num=trunc(mn/15)
  106.       end
  107. say
  108. say ot
  109. ot='('chime
  110. do num-1
  111.    ot=ot||',' chime
  112.    end
  113. ot=ot||'!)'
  114. return                                                        /* chime */
  115.  
  116. tell: say
  117. parse source . . . . . en .
  118. say en "donne l'heure en Francais."
  119. say "Executez" en "sans parametre pour avoir l'heure, ou avec"
  120. say "l'option 'STACK' pour avoir le resultat dans le stack."
  121. return
  122.  
  123.