예제 #1
0
파일: inifiles.cpp 프로젝트: gkathire/wxVCL
wxDateTime TIniFile::ReadULongDateTime(const wxString &Section,
  const wxString &Ident, wxDateTime Default)
{
	unsigned long WxTicks = ReadULong(Section, Ident, Default.GetTicks());
	wxDateTime Result((time_t)WxTicks);
	return Result;
}
예제 #2
0
bool DateChooserWidget::GetDate(wxDateTime &date)
{
	int ret = wxID_OK;
	
	date_control->SetDate(date);
	hour_control->SetValue(date.GetHour());
	minute_control->SetValue(date.GetMinute());

	current_minute = date.GetMinute();
	current_second = date.GetSecond();
	
	while( (ret = ShowModal()) == wxID_OK){ 

		date = date_control->GetDate();
		
		// ustawiamy godzine
		date.SetHour(hour_control->GetValue());
		date.SetMinute(minute_control->GetValue());
		if (second_control)
			date.SetSecond(second_control->GetValue());

		wxDateTime tmin(time_t(0));
		wxDateTime tmax(MAX_TIME_T_FOR_WX_DATE_TIME);
		
		if (date <= tmin || date >= tmax) {
			wxMessageBox(_("Invalid (too large/small) date"), _("Error!"), wxOK);
			return false;
		}

		if (min_date == -1 && max_date == -1)
			return true;

		if(date.GetTicks() >= min_date && date.GetTicks() <= max_date)
			return true;
		else {
      			wxString buf;
			buf = _("Please choose the date from between: ");
			buf += wxDateTime(min_date).Format(_T("%Y-%m-%d %H:%M "));
			buf += _("and");
			buf += wxDateTime(max_date).Format(_T(" %Y-%m-%d %H:%M\n"));
			wxMessageDialog *mesg = new wxMessageDialog(this, buf, _("Incorrect date range"), wxOK);
			mesg->ShowModal();
			delete mesg;
		}
	} 
	return false;
}
예제 #3
0
double CompDateAxis::DateToDataCoord(wxDateTime &date)
{
    wxDateTime firstDate, lastDate;
    if (!GetFirstLastDate(firstDate, lastDate)) {
        return 0;
    }

    double dataValue = m_dateCount * (double) (date.GetTicks() - firstDate.GetTicks()) / (double) (lastDate.GetTicks() - firstDate.GetTicks());
    return dataValue;
}
예제 #4
0
파일: inifiles.cpp 프로젝트: gkathire/wxVCL
wxDateTime TIniFile::ReadTime(const wxString &Section, const wxString &Ident,
  wxDateTime Default)
{
	long ticks = ReadLong(Section, Ident, Default.GetTicks());
	if (ticks == 0)
		return Default;
	wxDateTime result (ticks);
	if (result.IsValid())
		return result;
	else
		return Default;
}
예제 #5
0
wxString nwxString::FormatDateTime(const wxDateTime &dt, const wxString &sDefault)
{
  wxString sRtn;
  if(dt.GetTicks() == 0)
  {
    sRtn = sDefault;
  }
  else
  {
    sRtn = dt.Format(nwxString::TIME_FORMAT);
  }
  return sRtn;
}
예제 #6
0
파일: logs.cpp 프로젝트: mauroc/squiddio_pi
wxString logsWindow::timeAgo(wxDateTime currTime) {
    int delta = wxDateTime::Now().GetTicks() - currTime.GetTicks();
    wxString timeString;

    if (delta == 0)
    {
        return _("Just now");
    } else if (delta == 1)
    {
        return _("One second ago");
    } else if (delta < MINUTE)
    {
        timeString.Printf(_("%i seconds ago"), delta);
        return timeString;
    } else if (delta < 2 * MINUTE)
    {
        return _("About a minute ago");
    } else if (delta < 45 * MINUTE)
    {
        timeString.Printf(_("%i minutes ago"), delta/MINUTE);
        return timeString;
    } else if (delta < 90 * MINUTE)
    {
        return _("About an hour ago");
    } else if (delta < DAY)
    {
        timeString.Printf(_("%i hours ago"), delta/HOUR);
        return timeString;
    } else if (delta < 48 * HOUR)
    {
        return _("Yesterday");
    } else if (delta < 365 * DAY)
    {
        timeString.Printf(_("%i days ago"), delta/DAY);
        return timeString;
    } else {
        return wxEmptyString;
    }
}
예제 #7
0
파일: main.cpp 프로젝트: Hanmac/rwx
VALUE wrap< wxDateTime >(const wxDateTime &st )
{
	if(!st.IsValid())
		return Qnil;
	return rb_time_new(st.GetTicks(),st.GetMillisecond() * 10);
}
예제 #8
0
파일: inifiles.cpp 프로젝트: gkathire/wxVCL
void TIniFile::WriteTime(const wxString &Section, const wxString &Ident,
	wxDateTime Value)
{
	WriteLong(Section, Ident, Value.GetTicks());
}