home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma45.dms / ma45.adf / ETime / ETime.e < prev    next >
Text File  |  2002-10-23  |  3KB  |  102 lines

  1. /* I t 's ...
  2.  
  3.    @@@@@@  @@@@@@  @@
  4.    @@        @@
  5.    @@@@@     @@    @@  @@@@@@@@@    @@@@
  6.    @@        @@    @@  @@  @@  @@  @@  @@
  7.    @@        @@    @@  @@  @@  @@  @@@@@@
  8.    @@        @@    @@  @@  @@  @@  @@
  9.    @@@@@@    @@    @@  @@  @@  @@   @@@@
  10.  
  11.    N o   R i g h t s   R e s e r v e d    ( P u b l i c )
  12.  
  13.    B Y:
  14.         A N D R Z E J   J A R M O N I U K
  15.      S O F T W A R E    D E V E L O P M E N T
  16.  
  17.    (b a s e d   o n   t h e   t r u e   Amiga_E v2.1b   a n d ...
  18.     a n   o l d,   g r e a t   K S 1 . 3 ! ! !)
  19.  
  20.    Mails ( but not E-mails, I'm soooorry :'( ) are warmly received:
  21.         Andrzej Jarmoniuk, ul. Pîocka 30/43, 06400 Ciechanów, POLAND
  22. */
  23.  
  24. MODULE 'intuition/intuition', 'exec/ports', 'dos/dos', 'dos/datetime',
  25. 'intuition/screens'
  26.  
  27. ENUM OK,WARNING
  28.  
  29. PROC main() HANDLE
  30.  
  31.     CONST MINUTES_PER_HOUR = 60,
  32.     SECONDS_PER_MINUTE = 60,        /* for clearing the source */
  33.     KEEP_OLD = -1
  34.  
  35.     DEF ds:datestamp,
  36.     wnd:window,msg:intuimessage,port:mp,scr:screen,
  37.     h_str[3]:STRING,m_str[3]:STRING,s_str[3]:STRING,
  38.     time_str[9]:STRING,
  39.     barh=10
  40.  
  41.     /* here we are:
  42.             I DON'T KNOW, why a lot people complained that they couldn't
  43.             use DateStamp() function.
  44.             So, if you didn't know it, read this source carefully.
  45.     */
  46.  
  47.     
  48.     wnd:=NIL; scr:=NIL
  49.     IF KickVersion(36)
  50.         IF (scr:=LockPubScreen(NIL))=NIL
  51.             WriteF('Could not lock the screen!\n')
  52.             Raise(WARNING)
  53.         ENDIF
  54.         barh:=scr.barheight+1
  55.     ENDIF
  56.     IF (wnd:=OpenWindow([0,0,135,barh,0,1,IDCMP_CLOSEWINDOW,
  57.         WFLG_RMBTRAP+WFLG_DRAGBAR+WFLG_DEPTHGADGET+WFLG_CLOSEGADGET+
  58.         WFLG_NOCAREREFRESH,
  59.         NIL,NIL,NIL,NIL,NIL,NIL,NIL,NIL,NIL,
  60.         WBENCHSCREEN]:nw))=NIL
  61.     
  62.         WriteF('Could not OPEN THE WINDOW!\n')
  63.         Raise(WARNING)
  64.     ENDIF
  65.     port:=wnd.userport
  66.     
  67.     SetWindowTitles(wnd,NIL,'                      '+
  68.         'ETime, © 1995, Andrzej Jarmoniuk Software Development')
  69.  
  70.     /*******************************************************/
  71.     /** WATCH THIS CAREFULLY! THIS IS THE MAIN COURSE :-) **/
  72.     /*******************************************************/
  73.  
  74.     REPEAT
  75.         DateStamp(ds)
  76.  
  77.         StringF( h_str, '\d[2]', ds.minute / MINUTES_PER_HOUR )
  78.         StringF( m_str, '\z\d[2]', Mod( ds.minute, SECONDS_PER_MINUTE ) )
  79.         StringF( s_str, '\z\d[2]', ds.tick / TICKS_PER_SECOND )
  80.  
  81.         StringF( time_str, '\s:\s:\s', h_str, m_str, s_str )
  82.  
  83.         SetWindowTitles( wnd, time_str, KEEP_OLD )
  84.  
  85.         /*    WindowToFront(wnd)    */
  86.  
  87.         Delay(25)
  88.     UNTIL msg:=GetMsg(port)
  89.     ReplyMsg(msg)
  90.  
  91.     /*******************************************************/
  92.     /** AND SO IT WAS...                                  **/
  93.     /*******************************************************/
  94.  
  95.     Raise(OK)
  96. EXCEPT
  97.     IF wnd THEN CloseWindow(wnd)
  98.     IF scr THEN UnlockPubScreen(NIL, scr)
  99.     IF exception THEN RETURN 5
  100. ENDPROC
  101.  
  102. CHAR '$VER: ETime, © Andrzej Jarmoniuk Software Development', 0