home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / MiscKit / Headers / misckit / MiscTime.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-23  |  2.1 KB  |  91 lines

  1. //
  2. //    MiscTime.h -- a generic class to simplify manipulation of times
  3. //        Written by Don Yacktman Copyright (c) 1993 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //        This notice may not be removed from this source code.
  6. //
  7. //    This object is included in the MiscKit by permission from the author
  8. //    and its use is governed by the MiscKit license, found in the file
  9. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  10. //    for a list of all applicable permissions and restrictions.
  11. //    
  12.  
  13. #import <appkit/appkit.h>
  14.  
  15. #define MISC_TIME_UNKNOWN_DOW -1    // for uncalced day of week
  16. #define MISC_TIME_MAX_MICROSECONDS 1000000
  17. #define MISC_TIME_MAX_SECONDS 60
  18. #define MISC_TIME_MAX_MINUTES 60
  19. #define MISC_TIME_MAX_HOURS 24
  20. #define MISC_TIME_MAX_DAYS 365
  21. #define MISC_TIME_MAX_MONTHS 12
  22.  
  23. @interface MiscTime: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.