home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / daymisckit_proj / Headers / daymisckit / DAYTime.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-11  |  2.0 KB  |  91 lines

  1. //
  2. //    DAYTime.h -- a generic class to simplify manipulation of times
  3. //        Written by Don Yacktman (c) 1993 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //
  6. //        This is a free object!  Contact the author for the latest version.
  7. //        Don Yacktman, 4279 N. Ivy Lane, Provo, UT, 84604
  8. //        e-mail:  Don_Yacktman@byu.edu
  9. //
  10. //    See DAYTime.m for details of the software license.
  11. //
  12.  
  13. #import <appkit/appkit.h>
  14.  
  15. #define DAY_UNKNOWN_DOW -1    // for uncalced day of week
  16. #define DAY_MAX_MICROSECONDS 1000000
  17. #define DAY_MAX_SECONDS 60
  18. #define DAY_MAX_MINUTES 60
  19. #define DAY_MAX_HOURS 24
  20. #define DAY_MAX_DAYS 365
  21. #define DAY_MAX_MONTHS 12
  22.  
  23. @interface DAYTime:Object <NXTransport>
  24. {
  25.     BOOL isRelative; // if we are absolute date or a relative measure.
  26.     long microsecond, second, minute, hour, dow, day, month, year;
  27.     char *myStringValue;
  28.     @private BOOL _initted;
  29. }
  30.  
  31. - init;
  32. - initWithCurrentTime;
  33.  
  34. - setYear:(int)t;
  35. - setMonth:(int)t;
  36. - setDayOfWeek:(int)t;
  37. - calcDayOfWeek;        // set the year, month, and day first.
  38. - setDay:(int)t;
  39. - setHour:(int)t;
  40. - setMinute:(int)t;
  41. - setSecond:(int)t;
  42. - setMicrosecond:(int)t;
  43. - setRelative:(BOOL)t;
  44. - (BOOL)isRelative;
  45.  
  46. - (int)_nintValue; // private method, does intValue w/o usecs.
  47. - (int)intValue;
  48. - (float)floatValue;
  49. - (double)doubleValue;
  50. - (const char *)stringValue;
  51.  
  52. - (int)year;
  53. - (int)month;
  54. - (int)dayOfWeek;
  55. - (int)day;
  56. - (int)hour;
  57. - (int)minute;
  58. - (int)second;
  59. - (int)microsecond;
  60.  
  61. - addTime:aTime;
  62. - subtractTime:aTime;
  63.  
  64. - addMicroseconds:(long)t;
  65. - addSeconds:(long)t;
  66. - addMinutes:(long)t;
  67. - addHours:(long)t;
  68. - addDays:(long)t;
  69. - addWeeks:(long)t;
  70. - addMonths:(long)t;
  71. - addYears:(long)t;
  72.  
  73. - subtractMicroseconds:(long)t;
  74. - subtractSeconds:(long)t;
  75. - subtractMinutes:(long)t;
  76. - subtractHours:(long)t;
  77. - subtractDays:(long)t;
  78. - subtractWeeks:(long)t;
  79. - subtractMonths:(long)t;
  80. - subtractYears:(long)t;
  81.  
  82. - (BOOL)isAfter:aTime;
  83. - (BOOL)isEqual:aTime;
  84.  
  85. - copy;
  86. - copyTimeFrom:aTime;
  87. - read:(NXTypedStream *)stream;
  88. - write:(NXTypedStream *)stream;
  89.  
  90. @end
  91.