home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 007.lha / settime / read_me! < prev    next >
Text File  |  1986-11-10  |  3KB  |  73 lines

  1. Comments on the TimeSet program...
  2.  
  3. version 1.0   9/19/86  written in Lattice C v3.03b
  4.  
  5. Length of compiled file TIMESET -- 20112 bytes
  6.  
  7. TIMESET allows you to set the date and time on your Amiga using slider
  8. controls.  I include it as part of my boot sequence (defined in
  9. <bootdisk>:s/startup-sequence):
  10.  
  11.   <commands>
  12.   :timeset
  13.   <commands>
  14.  
  15. For this to work TIMESET must be in the root directory of your bootdisk.  If
  16. you put it somewhere else you must tell AmigaDos how to find it; that's what
  17. the colon before TIMESET is doing.
  18.  
  19. There are two source code files contained in the archive, DATE.C and TIMESET.C.
  20. In addition, a compiled and linked version of TIMESET is included.
  21.  
  22. *** TIMESET calls certain functions defined in DATE, so if you will need to
  23. link the object files together in order to get a functional program. ***
  24.  
  25. DATE is provided separately since I've found that the functions in it are
  26. useful in other situations.  Also, it was easier to write the overall program
  27. by splitting it into smaller pieces!
  28.  
  29. If you look at TIMESET.C you will no doubt notice that a number of the
  30. functions and variable definitions do not have to have the global scope they
  31. are given.  Right you are!  This is a vestige of an earlier approach I took in
  32. writing the program which I was too lazy to change.  Of course, as I said
  33. above, having the separate functions does make (at least for me) it easier to
  34. design and write the overall program.  In this instance I didn't think the loss
  35. in speed due to the function calls was worth the ability to fragment the
  36. program.  If you feel differently, be my guest and change the source code.
  37.  
  38. In two places in TIMESET.C I call sprintf() to build a formatted string.  One
  39. part of that formatting is the need to display the current minute count as a
  40. two digit field with a leading zero.  I first tried to do this as follows (I've
  41. simplified this fragment for clarity):
  42.  
  43.      sprintf("%.2d",Minute);
  44.  
  45. This generated a 2 digit field, but with a leading blank.  I then tried:
  46.  
  47.      sprintf("%2.2d",Minute);
  48.  
  49. with the same result.  Finally, I read the fine print in my C bible
  50. ("Programming in C", (c) 1983 by Stephen G. Kochan; I recommend it) and used:
  51.  
  52.      sprintf("%02d",Minute);
  53.  
  54. which worked.  Unfortunately, a footnote said (ibid, p. 287)
  55.  
  56.      "2 This modifier is no longer officially supported as of Release 3.0
  57.       of UNIX and has been replaced with a new interpretation of the
  58.       .precision modifier."
  59.  
  60. The 'new interpretation' was not described.  My Lattice documentation does not
  61. say one way or another whether what I did should work.  It does as of v3.03b,
  62. but who can tell what the future holds?
  63.  
  64. If worse comes to worse you could replace the sprintf() calls with numeric to
  65. string conversions, padders (i.e., add leading zero when necessary) and a slew
  66. of concatenations.  Being lazy, I prefer the sprintf() route -- even though
  67. I've been warned by many more experience programmers that one should use the
  68. printf() and scanf() routines only as a last resort.
  69.  
  70. Enjoy!!
  71.  
  72. Mark Olbert
  73. aka ChairmanMAO