DBFloat DBDate::DecimalMonth () const { DBFloat decDate; DBInt month, nDays; decDate = (FlagsVAR & DBTimeStepYear) == DBTimeStepYear ? Year () * 12 : 0.0; if ((FlagsVAR & DBTimeStepMonth) != DBTimeStepMonth) return (decDate + 6.0); if ((FlagsVAR & DBTimeStepDay) != DBTimeStepDay) return (decDate + ((DBFloat) Month () + 0.5) / 12.0); month = Month (); nDays = _DBNumberOfDays [month] + ((month == 1) && DBDateIsLeapYear (Year ()) ? 1 : 0); if ((FlagsVAR & DBTimeStepHour) != DBTimeStepHour) return (decDate + Month () + ((DBFloat) Day () / (DBFloat) nDays)); if ((FlagsVAR & DBTimeStepMinute) != DBTimeStepMinute) return (decDate + ((DBFloat) Day () + Hour () / 24) / (DBDateIsLeapYear (Year ()) ? 365.0 : 366.0)); return (decDate + ((DBFloat) Day () + (Hour () + Minute () / 60.0) / 24) / (DBDateIsLeapYear (Year ()) ? 365.0 : 366.0)); }
DBFloat DBDate::DecimalYear () const { DBFloat decDate; DBInt month, day; decDate = (FlagsVAR & DBTimeStepYear) == DBTimeStepYear ? Year () : 0.0; if ((FlagsVAR & DBTimeStepMonth) != DBTimeStepMonth) return (decDate + 0.5); if ((FlagsVAR & DBTimeStepDay) != DBTimeStepDay) return (decDate + ((DBFloat) Month () + 0.5) / 12.0); day = (DBDateIsLeapYear (Year ()) && (Month () > 1)) ? 1 : 0; for (month = 0;month < Month ();++month) day += _DBNumberOfDays [month]; if ((FlagsVAR & DBTimeStepHour) != DBTimeStepHour) return (decDate + (DBFloat) day / (DBDateIsLeapYear (Year ()) ? 365.0 : 366.0)); if ((FlagsVAR & DBTimeStepMinute) != DBTimeStepMinute) return (decDate + ((DBFloat) day + Hour () / 24) / (DBDateIsLeapYear (Year ()) ? 365.0 : 366.0)); return (decDate + ((DBFloat) day + (Hour () + Minute () / 60.0) / 24) / (DBDateIsLeapYear (Year ()) ? 365.0 : 366.0)); }
CL_String CL_TimeOfDay::PrintString (TimePrintForm form) const { CL_String time_string; long hour = Hour(); long min = Minute(); long sec = Second(); switch (form) { case Time_Military: { CL_String smin (min, 2, '0'), ssec (sec, 2, '0'); time_string = CL_String(hour, 2, '0') + ":" + smin + ":" + ssec; break; } case Time_Normal: default: { CL_String tmin (min, 2); if (hour > 12) { hour -= 12; time_string = CL_String(hour) + ":" + tmin + " pm"; } else if (hour == 12) time_string = CL_String(hour) + ":" + tmin + " pm"; else time_string = CL_String(hour) + ":" + tmin + " am"; break; } } return time_string; }
DBInt DBDate::Minute () const { DBInt flags = DBTimeStepDay | DBTimeStepHour | DBTimeStepMinute; if ((FlagsVAR & flags) != flags) return (DBDefaultMissingIntVal); return (MinutesVAR - Day () * 24 * 60 - Hour () * 60); }
TSystemTime TTime::GetSystemTime() const { TDate dt(*this); return TSystemTime(dt.Year(), dt.Month(), dt.DayOfMonth(), Hour(),Minute(), Second(), dt.WeekDay()); }
int JamToDetik(Jam J) /* Konversi Jam menjadi detik */ { /* Kamus Lokal */ /* Algoritma */ return(3600 *Hour(J) + 60 *Minute(J) + Second(J)); }
std::string Song::ToCueString() const { auto oss = std::ostringstream(); oss << "TRACK "<< Number() << " AUDIO" << std::endl << "TITLE \"" << Title() << "\"" << std::endl << "PERFORMER \"" << Artist() << "\"" << std::endl << "INDEX 01 " << Hour()*60 + Minute() << ':' << Second() << ":00"; return oss.str(); }
bool MC2Direction::InFrontOfUser(int headingAngle) const { MC2Direction::ClockType ct = Hour(headingAngle); return (ct >= HOUR_0 && ct <= HOUR_3) || (ct >= HOUR_9 && ct <= HOUR_11); }
void TulisJam(Jam J) /* I.S. : J sembarang*/ /* F.S. : J ditulis ke layar dengan format HH:MM:SS */ /* Proses : Menulis ke layar */ { /* Kamus lokal */ /* Algoritma */ printf("%d:%d:%d",Hour(J),Minute(J),Second(J)); }
void Date::setTime(int d, int m, int y) { int h = Hour(); int m = Minute(); int s = Second(); SetTime(h, m, s, d, m, y); log.info("Time set hour: %d minute: %d second: %d day: %d month: %d year: %d", h, m, s, d, m, y); }
Jam MakeJam(int H, int M, int S) /* Membentuk Jam dari H, M, S yg valid */ { /* Kamus Lokal */ Jam J1; /* Algoritma */ Hour(J1) = H; Minute(J1) = M; Second(J1) = S; return J1; }
int CTimeDate::MillisecondsSinceMidnight (void) const // MillisecondsSinceMidnight // // Returns the number of milliseconds since midnight { return Millisecond() + (Second() * 1000) + (Minute() * 60 * 1000) + (Hour() * 60 * 60 * 1000); }
Jam DetikToJam(int N) /* Konversi detik ke Jam */ { /* Kamus Lokal */ int sisa; Jam JOut; /* Algoritma */ Hour(JOut) = N / 3600; sisa = N % 3600; Minute(JOut) = sisa / 60; Second(JOut) = sisa % 60; return JOut; }
char *DBDate::Get () const { static char dateStr [DBStringLength]; if ((FlagsVAR & DBTimeStepYear) == DBTimeStepYear) sprintf (dateStr,"%04d",Year ()); else sprintf (dateStr,"XXXX"); if ((FlagsVAR & DBTimeStepMonth) == DBTimeStepMonth) sprintf (dateStr + strlen (dateStr),"-%02d",Month () + 1); if ((FlagsVAR & DBTimeStepDay) == DBTimeStepDay) sprintf (dateStr + strlen (dateStr),"-%02d",Day () + 1); if ((FlagsVAR & DBTimeStepHour) == DBTimeStepHour) sprintf (dateStr + strlen (dateStr)," %02d",Hour ()); if ((FlagsVAR & DBTimeStepMinute) == DBTimeStepMinute) sprintf (dateStr + strlen (dateStr),":%02d",Minute ()); return (dateStr); }
/** * Returns the internally stored time, formatted as a UTC time * * @return string The internalized time, in UTC format */ QString iTime::UTC() const { QString utc = YearString() + "-" ; if(Month() < 10) utc += "0" + MonthString() + "-"; else utc += MonthString() + "-"; if(Day() < 10) utc += "0" + DayString() + "T"; else utc += DayString() + "T"; if(Hour() < 10) utc += "0" + HourString() + ":"; else utc += HourString() + ":"; if(Minute() < 10) utc += "0" + MinuteString() + ":"; else utc += MinuteString() + ":"; if(Second() < 10) utc += "0" + SecondString(); else utc += SecondString(); return utc; }
/** * Returns the hour portion of the time as a string * * @return string */ QString iTime::HourString() const { return toString(Hour()); }
TimeSpan DateTime::TimeOfDay() throw() { return TimeSpan(Hour(), Minute(), Second(), Millisecond()); }
//----------------------------------------------------------------------------------------------- int init() { // E Farrell 2013 IndicatorDigits(10); IndicatorShortName("LEVY PHASE (F. Farrell)"); // Show or Hide a particular line? // // Use "DRAW_NONE" to hide a line // Use "DRAW_LINE" to display a line // Line 0: // Stochastic Volatility Line SetIndexBuffer (0, vols); SetIndexLabel (0, "Volatility"); SetIndexDrawBegin (0, Lookback); SetIndexStyle (0, DRAW_NONE); //SetIndexStyle (0, DRAW_LINE); // Line 1: // Levy Index of closing price (signal) SetIndexBuffer (1, levy_signal); SetIndexLabel (1, "levy_signal"); SetIndexDrawBegin (1, Lookback*2); SetIndexStyle (1, DRAW_NONE); //SetIndexStyle (1, DRAW_LINE); // Line 2: // Levy Index of Volatility SetIndexBuffer (2, levy_vol); SetIndexLabel (2, "levy_vol"); SetIndexDrawBegin (2, Lookback*2); SetIndexStyle (2, DRAW_NONE); //SetIndexStyle (2, DRAW_LINE); // Line 3: // Wrapped Phase Line SetIndexBuffer (3, phase_wrapped); SetIndexLabel (3, "Phase (wrapped)"); SetIndexDrawBegin (3, Lookback*2); //SetIndexStyle (3, DRAW_NONE); SetIndexStyle (3, DRAW_LINE); // Line 4: // Unwrapped Phase Line SetIndexBuffer (4, phase_unwrapped); SetIndexLabel (4, "Phase (Unwrapped)"); SetIndexDrawBegin (4, Lookback*2); //SetIndexStyle (4, DRAW_NONE); SetIndexStyle (4, DRAW_LINE); // Line 5: // Linear approximation of unwrapped phase SetIndexBuffer (5, least_squares_line); SetIndexLabel (5, "Regression Line"); SetIndexDrawBegin (5, Lookback*2); //SetIndexStyle (5, DRAW_NONE); SetIndexStyle (5, DRAW_LINE); // Line 6: // Final Adjusted Phase Line SetIndexBuffer (6, phase_adjusted); SetIndexLabel (6, "Phase (Adjusted)"); SetIndexDrawBegin (6, Lookback*2); SetIndexStyle (6, DRAW_LINE); if (DEBUG == 1) { // Create Debug File to show array values. // It is CSV style, with ";" as field seperators. // // Name: 'Debug File HH-MM.txt' // Location: 'c:\<<alpari directory>>\experts\files\' // file_name = "DebugFile "; file_name = StringConcatenate (file_name, DoubleToStr(Hour()-2,0), "-"); file_name = StringConcatenate (file_name, DoubleToStr(Minute(),0), ".txt"); file_handle = FileOpen (file_name, FILE_CSV|FILE_WRITE, ";"); Print (file_name, " was opened."); if(file_handle == -1) { // File Error occurred Alert ("An error while opening the file. Last Error: ", GetLastError()); } } return(0); }
MC2Direction::ClockType MC2Direction::Hour(const MC2Direction& headingDirection) const { return Hour(headingDirection.m_angle); }
void RINGTIME::Ring(const NOWTIME &x) { pNow_time = x; if(pNow_time.Minute() == Minute() && pNow_time.Hour() == Hour()) putchar('\a'),OutputTime_Remark(); if(pNow_time.Day() == Day() && pNow_time.Month() == Month() && pNow_time.Year() == Year()) OutputDate_Remark(); }
void Hour::normalize() { *this = Hour( hour() ); }
DBInt DBDate::HoursAD () const { DBInt hours = DaysAD () * 24; return ((FlagsVAR & DBTimeStepHour) == DBTimeStepHour ? hours + Hour () : hours + 12); }
std::string MDB::MDBDate:: ToString(std::string format_) { std::stringstream ss; for(unsigned int i=0; i< format_.length(); i++) { switch(format_[i]) { case 'y': ss<<std::setfill('0')<<std::setw(2); ss<<Year()%100; break; case 'Y': ss<<Year(); break; case 'm': ss<<std::setfill('0')<<std::setw(2); ss<<Month(); break; case 'M': ss<<Month(); break; case 'd': ss<<std::setfill('0')<<std::setw(2); ss<<Day(); break; case 'D': ss<<Day(); break; case 'g': ss<<(Hour()%12); break; case 'G': ss<<Hour(); break; case 'h': ss<<std::setfill('0')<<std::setw(2); ss<<(Hour())%12; break; case 'H': ss<<std::setfill('0')<<std::setw(2); ss<<Hour(); break; case 'i': ss<<std::setfill('0')<<std::setw(2); ss<<Minute(); break; case 'I': ss<<Minute(); break; case 's': ss<<std::setfill('0')<<std::setw(2); ss<<Second(); break; case 'S': ss<<Second(); break; default: ss<<format_[i]; } } return ss.str(); }