示例#1
0
	void TaskDlg::UpdateData()
	{
		GetText(title, IDC_CREATE_TASK_EDIT_TITLE);
		GetText(desc, IDC_CREATE_TASK_EDIT_DESCRIPTION);
		GetText(assignee, IDC_CREATE_TASK_ASSIGNEE_COMBO);
		GetText(group, IDC_CREATE_TASK_GROUP_COMBO);

		start = GetDate(IDC_CREATE_TASK_DATETIMEPICKER_START, 0, 0);
		due = GetDate(IDC_CREATE_TASK_DATETIMEPICKER_DUE, 23, 59);

		TreeItem *pItem = m_pTaskCombo->GetSelectedItem();
		if(pItem)
		{
			TaskItem *pTaskItem = static_cast<TaskItem *>(pItem);
			parentId = pTaskItem->m_pTask->GetId();
			parentTask = pTaskItem->m_pTask;
		}

		HWND hwndTemp = GetDlgItem(m_hwnd, IDC_CREATE_TASK_COMBO_PRIORITY);
		LRESULT comboItem = ::SendMessage(hwndTemp, CB_GETCURSEL, 0, 0);
		priority = comboItem != CB_ERR? comboItem + 1: 3;

		estimate = 0;//EMPTY_DURATION;
		if(m_pEstDuration->IsChecked())
		{
			estimate = m_pEstDuration->GetDuration();
		}


	}
示例#2
0
bool CheckSymbolsAndWriteOut(const char *define_type, const char *define_value, char *sOut)
{
	if( !strcmp(define_type, STRING_DATE) )
	{
		char sNewDate[50];
		if( !GetDate(sNewDate, NULL, true) )
			return false;
		
		str_ReplaceOnce(strstr(sOut, STRING_DATE), define_value, sNewDate);
	}
	if( !strcmp(define_type, STRING_TIME) )
	{
		char sNewTime[50];
		if( !GetDate(NULL, sNewTime, true) )
			return false;
		
		str_ReplaceOnce(strstr(sOut, STRING_TIME), define_value, sNewTime);
	}
	if( !strcmp(define_type, STRING_BUILD) )
	{
		char sNewBuild[50];
		if(!bIncrementVersion)
			return true;
		sprintf( sNewBuild, "%d", atoi(define_value)+1 );
		str_ReplaceOnce(strstr(sOut, STRING_BUILD), define_value, sNewBuild);
	}
	return true;
}
size_t mitk::DiffusionCollectionWriter::GetIndexForinXMonths(mitk::DiffusionCollectionReader::FileListType fileList,float months, size_t curIndex,std::vector<std::string> filter)
{
  std::string strDate0 = GetDate(fileList.at(0).at(curIndex),filter.at(0),true);

  int year0 =std::atoi(strDate0.substr(0,4).c_str());
  int month0 =std::atoi(strDate0.substr(5,2).c_str());
  int day0 = std::atoi(strDate0.substr(8,2).c_str());

  size_t bestIndex = 0;
  int bestFit = 1e5;

  for (size_t i=curIndex+1; i < fileList.at(0).size(); ++i)
  {
    std::string strDate = GetDate(fileList.at(0).at(i),filter.at(0),true);
    int year =std::atoi(strDate.substr(0,4).c_str());
    int month =std::atoi(strDate.substr(5,2).c_str());
    int day = std::atoi(strDate.substr(8,2).c_str());

    int fit = std::fabs((months * 30 ) - (((year-year0)*360) +((month-month0)*30) + (day-day0))); // days difference from x months
    if (fit < bestFit)
    {
      bestFit = fit;
      bestIndex = i;
    }
  }
  return bestIndex;
}
void CertDecoder::GetValidity()
{
    if (source_.GetError().What()) return;

    GetSequence();
    GetDate(BEFORE);
    GetDate(AFTER);
}
示例#5
0
/*
*********************************************************************************************************
*                                        Title in the file
*********************************************************************************************************
*/
void FileContentInit(void) {
	FILE* fp_source,*fp_receive;
	char filename[25];
	GetDate(filename);
	strcat(filename,"Sd.dat");
	fp_source = fopen(filename,"w");
	fprintf(fp_source,"%11s%5s%5s%5s%5s%5s%5s%5s%5s%5s%6s\n%6s","Source:(1)","(2)","(3)","(4)","(5)","(6)","(7)","(8)","(9)","(10)","(AVG)"," ");
	fclose(fp_source);
	GetDate(filename);
	strcat(filename,"Rv.dat");
	fp_receive = fopen(filename,"w");
	fprintf(fp_receive, "%11s%5s%5s%5s%5s%5s%5s%5s%5s%5s%6s\n%6s","Receive:(1)","(2)","(3)","(4)","(5)","(6)","(7)","(8)","(9)","(10)","(AVG)"," ");
	fclose(fp_receive);
}
示例#6
0
void CTraderApi::OnRtnForQuote(CUstpFtdcReqForQuoteField *pReqForQuote)
{
	QuoteRequestField* pField = (QuoteRequestField*)m_msgQueue->new_block(sizeof(QuoteRequestField));

	pField->TradingDay = GetDate(pReqForQuote->TradingDay);
	pField->QuoteTime = GetDate(pReqForQuote->ReqForQuoteTime);
	strcpy(pField->Symbol, pReqForQuote->InstrumentID);
	strcpy(pField->InstrumentID, pReqForQuote->InstrumentID);
	strcpy(pField->ExchangeID, pReqForQuote->ExchangeID);
	sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pField->ExchangeID);
	strcpy(pField->QuoteID, pReqForQuote->ReqForQuoteID);

	m_msgQueue->Input_NoCopy(ResponeType::OnRtnQuoteRequest, m_msgQueue, m_pClass, 0, 0,
		pField, sizeof(QuoteRequestField), nullptr, 0, nullptr, 0);
}
示例#7
0
bool CCit_gen::GetLabelV1(string* label, TLabelFlags flags) const
{
    bool unique = (flags & fLabel_Unique) != 0;

    if (IsSetSerial_number()) {
        *label += "[" + NStr::IntToString(GetSerial_number()) + "]";
    }
    if (IsSetMuid()) {
        *label += "NLM" + NStr::IntToString(GetMuid());
    }

    string date;
    string* date_ptr = 0;
    if ( IsSetDate() ) {
        date_ptr = &date;
        GetDate().GetDate(date_ptr, true);
    }

    const string* title2 = 0;
    const string* titleunique = 0;
    bool unpublished = false;
    const CTitle* title = IsSetJournal() ? &GetJournal() : 0;
    const CAuth_list* authors = IsSetAuthors() ? &GetAuthors() : 0;
    const string* volume = IsSetVolume() ? &GetVolume() : 0;
    const string* issue = IsSetIssue() ? &GetIssue() : 0;
    const string* pages = IsSetPages() ? &GetPages() : 0;

    if (IsSetCit()) {
        if ( NStr::EqualNocase( GetCit(), "Unpublished") ) {
            unpublished = true;
        } else if (!title) {
            title2 = &GetCit();
        }
    }
    if (IsSetTitle()) {
        titleunique = &GetTitle();
    } else if (title2) {
        titleunique = title2;
    } else if (!title && IsSetCit()) {
        titleunique = &GetCit();
    }
    if (!title && !authors && !IsSetTitle() && !volume &&
        !pages && !issue) {
        titleunique = 0;
        if (IsSetCit()) {
            string cit(GetCit());
            if (!unique) {
                try {
                    cit.resize(cit.find_last_of('|'));
                } catch(length_error&) {}
            }   
            *label += cit;
        }
        return true;
    }

    return x_GetLabelV1(label, unique,
        authors, 0, title, 0, 0, 0, title2, titleunique,
        date_ptr, volume, issue, pages, unpublished);
}
示例#8
0
void Chg_DOB()
{
    char	*temp;

    if (!CFG.iDOB)
	return;

    temp  = calloc(81, sizeof(char));
    ReadExitinfo();
    Syslog('+', "Old DOB %s", exitinfo.sDateOfBirth);

    while (TRUE) {
	Enter(1);
	/* Please enter your Date of Birth DD-MM-YYYY: */
	pout(CYAN, BLACK, (char *) Language(56));
	colour(CFG.InputColourF, CFG.InputColourB);
	GetDate(temp, 10);
	if (Test_DOB(temp)) {
	    Setup(exitinfo.sDateOfBirth, temp);
	    break;
	}
    }

    Syslog('+', "New DOB %s", exitinfo.sDateOfBirth);
    WriteExitinfo();
    free(temp);
}
示例#9
0
/*********************************
**函数名:SetRTCTime
**功能:设置时间,除了把Real_Time的值改变外,还要把时分秒转换为RTC计数值,年月日存到后备寄存器上
**注意事项:函数内会自动根据年月日计算星期,并且返回到*time上
**********************************/
void SetRTCTime(T_STRUCT* time)
{
	u32 count;
	RTC_ITConfig(RTC_IT_SEC, DISABLE);	//关闭秒中断

	RTC_WaitForLastTask();
	//付时间值到Real_Time上
	Real_Time.year=time->year;
	Real_Time.month=time->month;
	Real_Time.day=time->day;
	Real_Time.hour=time->hour;
	Real_Time.minute=time->minute;
	Real_Time.sec=time->sec;
	//计算星期
	time->date=Real_Time.date=GetDate(time);

	//把新的年月日存到掉电寄存器上

	BKP_WriteBackupRegister(BKP_TIME_DATE,Real_Time.date);
//	RTC_WaitForLastTask();
	BKP_WriteBackupRegister(BKP_TIME_DAY,Real_Time.day);
//	RTC_WaitForLastTask();
	BKP_WriteBackupRegister(BKP_TIME_MONTH,Real_Time.month);
//	RTC_WaitForLastTask();
	BKP_WriteBackupRegister(BKP_TIME_YEAR,Real_Time.year);
//	RTC_WaitForLastTask();

	//计算新的RTC count值
	count=Real_Time.hour*3600+Real_Time.minute*60+Real_Time.sec;
	RTC_WaitForLastTask();
	RTC_SetCounter(count);
	RTC_WaitForLastTask();
	RTC_ITConfig(RTC_IT_SEC, ENABLE); //打开秒中断
}
示例#10
0
BOOL WINAPI Show4Months(CCallbacks* pCallback, const char* szFile, HWND pParent)
{
	char szOutKey[256]={0};
	char szOutTitle[256]={0};
	BOOL bRes=GetDate(pCallback, szOutKey, sizeof(szOutKey), szOutTitle, sizeof(szOutTitle));
	return bRes;
}
示例#11
0
文件: NDate.cpp 项目: refnum/nano
//============================================================================
//		NDate::GetDayOfWeek : Get the day of the week.
//----------------------------------------------------------------------------
NIndex NDate::GetDayOfWeek(const NString &timeZone) const
{


    // Get the day of the week
    return(NTargetTime::GetDayOfWeek(GetDate(timeZone)));
}
示例#12
0
int32 FDateTime::GetDay( ) const
{
	int32 Year, Month, Day;
	GetDate(Year, Month, Day);

	return Day;
}
void CalendarControl::MessageReceived(BMessage *msg)
{
 switch(msg->what)
 {
  case CalendarControlButtonPressedMessage:
  {
   if(IsEnabled())
   {
    MakeFocus(true);
    int day, month, year;
    int first_year, last_year;
    GetDate(&day, &month, &year);
    GetYearRange(&first_year, &last_year);
    new MonthWindow(ConvertToScreen(BPoint(Bounds().left+1,Bounds().bottom+1)),
                                    new BMessenger(this),
                                    day, month, year, first_year, last_year);
   }
   break;
  }
  case 'MVME': // message has come from window with calendar
  {
   int32 day, month, year;
   msg->FindInt32("day",&day);
   msg->FindInt32("month",&month);
   msg->FindInt32("year",&year);
   SetDate((int)day, (int)month, (int)year);
   break;
  }
  default:
   BControl::MessageReceived(msg);
 }
}
示例#14
0
void StatePrintRace( ISState* pThis, int pTrack )
{
   int lCounter;

   if( pThis->mRaceTrackIndex[pTrack] != -1 )
   {

      printf( "<table border=2>\n" );

      printf( "<tr><td colspan=5>%s %d Laps</td></tr>\n",
               pThis->mTrack[ pThis->mRaceTrackIndex[ pTrack ] ].mName,
               pThis->mRaceTrackLaps[ pTrack ] );

      printf( "<tr><td>Rank</td><td>Player</td><td>Time</td><td>Date</td><td>Craft</td></tr>\n" );

      for( lCounter = 0; lCounter < IR_MAX_PLAYER_BT; lCounter++ )
      {
         if( pThis->mRaceRecord[pTrack][lCounter].mDuration > 0 )
         {
            printf( "<tr><td>%d</td><td>%s</td><td>%2d:%02d:%02d</td><td>%s</td><td>%s</td></tr>\n",
                    lCounter+1,
                    pThis->mRaceRecord[pTrack][lCounter].mUser,
                    (pThis->mRaceRecord[pTrack][lCounter].mDuration/60000),
                    (pThis->mRaceRecord[pTrack][lCounter].mDuration/1000)%60,
                    (pThis->mRaceRecord[pTrack][lCounter].mDuration/10)%100,                  
                    GetDate(pThis->mRaceRecord[pTrack][lCounter].mDate),
                    CraftModels[pThis->mRaceRecord[pTrack][lCounter].mCraft].mName );
         }
      }
      printf( "</table>" );
   }
}
示例#15
0
bool wxCalendarCtrlBase::GenerateAllChangeEvents(const wxDateTime& dateOld)
{
    const wxDateTime::Tm tm1 = dateOld.GetTm(),
                         tm2 = GetDate().GetTm();

    bool pageChanged = false;

    GenerateEvent(wxEVT_CALENDAR_SEL_CHANGED);
    if ( tm1.year != tm2.year || tm1.mon != tm2.mon )
    {
        GenerateEvent(wxEVT_CALENDAR_PAGE_CHANGED);

        pageChanged = true;
    }

    // send also one of the deprecated events
    if ( tm1.year != tm2.year )
        GenerateEvent(wxEVT_CALENDAR_YEAR_CHANGED);
    else if ( tm1.mon != tm2.mon )
        GenerateEvent(wxEVT_CALENDAR_MONTH_CHANGED);
    else
        GenerateEvent(wxEVT_CALENDAR_DAY_CHANGED);

    return pageChanged;
}
示例#16
0
void ErrLog( char *file, int line, char *fmt, ... )
{
    va_list ap;
    FILE   *fp;
    int    fd;
    char timebuf[20];
    char datebuf[20];
		char log_name[100];

		memset( log_name, 0, sizeof( log_name ) ) ;
		memset( datebuf, 0, sizeof( datebuf ) ) ;
		GetDate( datebuf );
		strcpy( log_name, LOG_FILE_NAME ) ;
		strcat( log_name, "." ) ;
		strcat( log_name, datebuf ) ;

    if ( (fp=fopen( log_name, "a+")) == NULL ) {
        fprintf(stderr, "open %s file error.\n", LOG_FILE_NAME);
        return;
    }
    fd = fileno(fp);
    lockf (fd, F_LOCK, 0l);
    GetTime( timebuf );
    fprintf (fp, "[%s] ", timebuf );
    fprintf (fp, "[%s line %d] :\n", file, line);
    va_start( ap, fmt );
    vfprintf( fp, fmt, ap );
		fprintf(fp, "\n");
    va_end( ap );
    lockf(fd, F_ULOCK, 0l);
    fclose(fp);
    return;
}
示例#17
0
/*********************************************************
*函数名:    Print()
*函数功能:  输入单个图书的全部信息
*
*函数参数:  void
*函数返回值:void
*********************************************************/
void Book::Print()
{
    cout <<  GetISBN()  << '\t'  << GetTitle() << '\t';
    cout << GetAuthor() << '\t'  << GetPublisher() << '\t';
    cout << GetDate() << '\t' << GetPrice();
    cout << setw(10) << GetCatalogNum() << setw(11) << GetNumber() << endl;
}
示例#18
0
void CTraderApi::OnRspQryInstrument(CUstpFtdcRspInstrumentField *pRspInstrument, CUstpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
	if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast))
	{
		if (pRspInstrument)
		{
			InstrumentField* pField = (InstrumentField*)m_msgQueue->new_block(sizeof(InstrumentField));

			strcpy(pField->InstrumentID, pRspInstrument->InstrumentID);
			strcpy(pField->ExchangeID, pRspInstrument->ExchangeID);

			strcpy(pField->Symbol, pRspInstrument->InstrumentID);
			strncpy(pField->ProductID, pRspInstrument->ProductID, sizeof(InstrumentIDType));

			strcpy(pField->InstrumentName, pRspInstrument->InstrumentName);
			pField->Type = CUstpFtdcRspInstrumentField_2_InstrumentType(pRspInstrument);
			pField->VolumeMultiple = pRspInstrument->VolumeMultiple;
			pField->PriceTick = pRspInstrument->PriceTick;
			pField->ExpireDate = GetDate(pRspInstrument->ExpireDate);
			pField->OptionsType = TUstpFtdcOptionsTypeType_2_PutCall(pRspInstrument->OptionsType);
			pField->StrikePrice = pRspInstrument->StrikePrice == DBL_MAX ? 0 : pRspInstrument->StrikePrice;

			m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0);
		}
		else
		{
			m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0);
		}
	}
}
示例#19
0
void CTraderApi::OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
	RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField));

	if (!IsErrorRspInfo(pRspInfo)
		&&pRspUserLogin)
	{
		pField->TradingDay = GetDate(pRspUserLogin->tradeDate);
		pField->LoginTime = GetTime(pRspUserLogin->lastLoginTime);
		//sprintf(pField->SessionID, "%d:%d", pRspUserLogin->FrontID, pRspUserLogin->SessionID);

		m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, this, ConnectionStatus::Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0);
		m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, this, ConnectionStatus::Done, 0, nullptr, 0, nullptr, 0, nullptr, 0);

		// 记下登录信息,可能会用到
		memcpy(&m_RspUserLogin,pRspUserLogin,sizeof(CThostFtdcRspUserLoginField));
		m_nMaxOrderRef = atol(pRspUserLogin->localOrderNo);
		// 自己发单时ID从1开始,不能从0开始
		m_nMaxOrderRef = m_nMaxOrderRef>1 ? m_nMaxOrderRef:1;
	}
	else
	{
		pField->ErrorID = pRspInfo->ErrorID;
		strncpy(pField->ErrorMsg, pRspInfo->ErrorMsg, sizeof(ErrorMsgType));

		m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, this, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0);
	}
}
示例#20
0
void openSaveFile(){

  long int ii=0, jj=0, kk=0;
  char file_name[200]="hvmon-", tt[50]="\0";
/*
    Build file name out of date and time
*/
  sprintf(tt,"%s%c",GetDate(),'\0');
  jj=0;
  jj = strlen(tt);
  ii=0;
  kk=0;
  while (ii < jj) {
    if (isspace(tt[ii]) == 0) tt[kk++] = tt[ii];
    ii++;
  }
  tt[kk]='\0';
  if (jj > 0) strcat(file_name,tt);
  strcat(file_name,".conf\0");
/*
    Open file
*/
 if (( fileSave = fopen (file_name,"a+") ) == NULL){
   printf ("*** File on disk could not be opened \n");
   exit (EXIT_FAILURE);
 }
  printf("hvmon new config file opened: %s\n",file_name);             

  return;
}
示例#21
0
void wxGtkCalendarCtrl::GTKGenerateEvent(wxEventType type)
{
    // First check if the new date is in the specified range.
    wxDateTime dt = GetDate();
    if ( !IsInValidRange(dt) )
    {
        if ( m_validStart.IsValid() && dt < m_validStart )
            dt = m_validStart;
        else
            dt = m_validEnd;

        SetDate(dt);

        return;
    }

    if ( type == wxEVT_CALENDAR_SEL_CHANGED )
    {
        // Don't generate this event if the new date is the same as the old
        // one.
        if ( m_selectedDate == dt )
            return;

        m_selectedDate = dt;

        GenerateEvent(type);

        // Also send the deprecated event together with the new one.
        GenerateEvent(wxEVT_CALENDAR_DAY_CHANGED);
    }
    else
    {
        GenerateEvent(type);
    }
}
示例#22
0
void HttpdSocket::OnData(const char *p,size_t l)
{
	if (m_file)
	{
		m_file -> fwrite(p,1,l);
	}
	m_received += l;
	if (m_received >= m_content_length && m_content_length)
	{
		// all done
		if (m_file && !m_form)
		{
			m_form = new HttpdForm(m_file, m_content_type, m_content_length);
			AddResponseHeader("Date", datetime2httpdate(GetDate()) );
			if (GetUri() == "/image")
			{
				Send64(Utility::Logo, "image/png");
			}
			else
			{
				Exec();
			}
			Reset(); // prepare for next request
		}
	}
}
示例#23
0
void CValue::SaveToString(CString &Str)
{
	switch(nType)
	{
		case TYPE_NUMBER:
			{
				NUMBER f=GetNumber();
				if(f==int(f))
					Str.Format("{1/%d}",int(f));
				else
					Str.Format("{1/%f}",f);
				return;
			}
		case TYPE_STRING:

			Str=GetString();

			ReplaceBySave(Str);

			Str=CString("{2/")+Str+"}";

			return;
		case TYPE_DATE:
			Str.Format("{3/%d}",GetDate());
			return;
		case TYPE_REFFER:
			pRef->SaveToString(Str);
			return;
		break;
	};
	Str="{0/0}";
}
示例#24
0
文件: time.cpp 项目: IamKenshin/taiga
std::wstring GetAbsoluteTimeString(time_t unix_time) {
  std::tm tm;

  if (!unix_time || localtime_s(&tm, &unix_time))
    return L"Unknown";

  Duration duration(std::abs(time(nullptr) - unix_time));
  Date today = GetDate();

  auto strftime = [&tm](const char* format) {
    std::string result(100, '\0');
    std::strftime(&result.at(0), result.size(), format, &tm);
    return StrToWstr(result);
  };

  if (1900 + tm.tm_year < today.year) {
    return strftime("%d %B %Y");  // 01 January 2014
  } else if (std::lround(duration.days()) <= 1 && tm.tm_mday == today.day) {
    return strftime("%H:%M");  // 13:37
  } else if (std::lround(duration.days()) <= 7) {
    return strftime("%A, %d %B");  // Thursday, 01 January
  } else {
    return strftime("%d %B");  // 01 January
  }
}
示例#25
0
//=================================================================== GetDate
BOOL CNSDateEdit::GetDate( CTime &d )
{
    int nYear, nMonth, nDay;
    if ( !GetDate( nYear, nMonth, nDay ) )
        return FALSE;
    d = CTime( nYear, nMonth, nDay, 0, 0, 0 );
    return TRUE;
}
示例#26
0
文件: deal_fs.c 项目: jamjr/Helios-NG
static void 
init_Sum_Block (void)

/*
*  Initialise the SummaryBlock after formatting the hard disc.
*/

{
	word i;
	struct sum_blk *sbp;
	Date date;
     	struct buf *bp;

	/* allocate a buffer and clear its contents */
	bp = getblk(filedrive,1,1,NOSAVE);
	clr_buf (bp);
	sbp = bp->b_un.b_sum;

	/* initialise the DirEntry of the RootDirectory */
	sbp->root_dir.de_inode.i_mode = DIR; 
	sbp->root_dir.de_inode.i_size = sizeof(struct dir_elem); 
	sbp->root_dir.de_inode.i_db[0] = 3; 	
	sbp->root_dir.de_inode.i_blocks = 1; 		
	sbp->root_dir.de_inode.i_spare = 0; 			
	strcpy(sbp->root_dir.de_name,fs_name);
	/* the root directory has an initial matrix giving full access */
	/* The system administrator should restrict this after setting */
	/* up any special links.				       */
	sbp->root_dir.de_inode.i_matrix = -1; 
	date = GetDate();
	sbp->root_dir.de_inode.i_ctime = date; 			
	sbp->root_dir.de_inode.i_atime = date; 			
	sbp->root_dir.de_inode.i_mtime = date; 		 			
	
	/* Initialise SummaryInformations */
	sbp->sum_same = TRUE;

	/* Initialise the first_boot flag */
	sbp->first_boot = TRUE;
	
	/* SummaryInfo of the first cylinder group */
	sbp->cg_sum[0].s_ndir = 1;
	sbp->cg_sum[0].s_nbfree = maxbpg - 4;
	sbp->fs_sum = sbp->cg_sum[0];

	/* SummaryInfo of the remaining cylinder groups */
	for (i=1; i<maxncg; i++) 
	{
		sbp->cg_sum[i].s_ndir = 0;
		sbp->cg_sum[i].s_nbfree = maxbpg - 1;
		sbp->fs_sum.s_ndir += sbp->cg_sum[i].s_ndir;
		sbp->fs_sum.s_nbfree += sbp->cg_sum[i].s_nbfree;		
	}
		
	/* write to hard disc */
	bwrite(bp->b_tbp);						
}
示例#27
0
void Parser::WriteLog(const std::vector<Player*>& players) const
{
    json root;
    root["error_Log"] = FormatErrors(players);
    root["players"]   = FormatPlayers(players);
    root["linechart"] = FormatLinechart(players);
    root["date"]      = GetDate();
    WriteFile(root);
}
示例#28
0
void GetCalenderTime(CalenderTime *ct)
{
	ct->second = (uint8_t)GetSecond();
	ct->minute = (uint8_t)GetMinute();
	ct->hour   = (uint8_t)GetHour();
	ct->date   = (uint8_t)GetDate();
	ct->month  = (uint8_t)GetMonth();
	ct->year   = (uint8_t)GetYear();
}
示例#29
0
文件: lcd.cpp 项目: rpheuts/artillery
void LCD::RenderDateTime()
{
	// blit background to buffer
	Graphics::BlitImageToImage(0, 0, _bg->imageWidth, _bg->imageHeight, _bg, 0, 0, _buffer);
		
	Font::PrintImage(GetDate().c_str(), 5, textoffsety, _buffer, _textColor, 3);
	Font::PrintImage(GetTime().c_str(), 150, textoffsety, _buffer, _textColor, 3);
	_lastMinute = _timed->minutes;
}
示例#30
0
void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
    throw( IO_ERROR )
{
    // Don't write the title block information if there is nothing to write.
    bool isempty = true;
    for( unsigned idx = 0; idx < m_tbTexts.GetCount(); idx++ )
    {
        if( ! m_tbTexts[idx].IsEmpty() )
        {
            isempty = false;
            break;
        }
    }

    if( !isempty  )
    {
        aFormatter->Print( aNestLevel, "(title_block\n" );

        if( !GetTitle().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(title %s)\n",
                               aFormatter->Quotew( GetTitle() ).c_str() );

        if( !GetDate().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(date %s)\n",
                               aFormatter->Quotew( GetDate() ).c_str() );

        if( !GetRevision().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(rev %s)\n",
                               aFormatter->Quotew( GetRevision() ).c_str() );

        if( !GetCompany().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(company %s)\n",
                               aFormatter->Quotew( GetCompany() ).c_str() );

        for( int ii = 0; ii < 4; ii++ )
        {
            if( !GetComment(ii).IsEmpty() )
                aFormatter->Print( aNestLevel+1, "(comment %d %s)\n", ii+1,
                                  aFormatter->Quotew( GetComment(ii) ).c_str() );
        }

        aFormatter->Print( aNestLevel, ")\n\n" );
    }
}