//File : MilTime.h //Author : Andre Long //Due : November 24, 2004 //Description : This header file was derived from the Time class and will itself be // used for the base class of TimeClock class #ifndef MilTime_H #define MilTime_H #include #include "Time.h" using std::cout; using std::endl; class MilTime : public Time { protected: long milHours; long milSeconds; bool flagMilHours; bool flagMilSeconds; bool PMflag; public: MilTime() { milHours=0; milSeconds=0; } MilTime(long mh, long ms) { milHours=mh; milSeconds=ms; checkMilHours(); checkMilSeconds(); if(flagMilHours==true && flagMilSeconds==true) { convertStandard(); } else cout<<"XMXMXMXM Check Mil time format XMXMXMXM"<2359) { flagMilHours=false; } else { flagMilHours=true; long milMIN=(milHours%100); if(milMIN<0 || milMIN >59) { flagMilHours=false; } else { flagMilHours=true; } } } void checkMilSeconds() { if(milSeconds <0 || milSeconds >59) { flagMilSeconds=false; } else { flagMilSeconds=true; } } void convertStandard() { long xHr = (milHours)/100; long xmin = (milHours)%100; long xSec = milSeconds; if(xmin>59) { xmin=(xmin-59); xHr=(xHr+1); } if(xHr>12) { xHr=(xHr-12); PMflag=true; } long stdHr=xHr; long stdmin=xmin; long stdsec=xSec; setHour(stdHr); setMin(stdmin); setSec(stdsec); Time standard(stdHr, stdmin, stdsec); } void setTime(long someMilitaryHour, long someMilitarySecond) { milHours=someMilitaryHour; milSeconds=someMilitarySecond; checkMilHours(); checkMilSeconds(); if(flagMilHours==true && flagMilSeconds==true) { convertStandard(); } else cout<<"XMXMXMXM Check Mil time format XMXMXMXM"<