コード例 #1
0
ファイル: PROJECT.CPP プロジェクト: akreddysoft/CollegeCode
int CUSTOMER :: FINE(int ccode)
{
	ISSUE_RETURN ir ;
	int d1, m1, y1 ;
	struct date d;
	getdate(&d);
	d1 = d.da_day ;
	m1 = d.da_mon ;
	y1 = d.da_year ;
	fstream file ;
	file.open("CUSTOMER.DAT", ios::in) ;
	file.seekg(0,ios::beg) ;
	int days, t_fine ;
	while (file.read((char *) this, sizeof(CUSTOMER)))
	{
		if (code == ccode)
		{
			days = ir.DIFF(dd,mm,yy,d1,m1,y1) ;
			t_fine = days * 20 ;
			break ;
		}
	}
	file.close() ;
	return t_fine ;
}
コード例 #2
0
ファイル: MyOs.c プロジェクト: AngryHacker/OS_Lab
void date()
{
	/*
	 * 获取当前日期并输出
	 */
	print("The date is: ");
	getdate();
	yy = BCD_decode(ch1)*100 + BCD_decode(ch2);
	if(yy == 0) print("0000");
	else if(yy >0 && yy < 10) print("000");
	else if(yy > 10 && yy < 100) print("00");
	else if(yy > 100 && yy < 1000) print("0");
	printInt(yy);
	printChar('/');
	mm = BCD_decode(ch3);
	if(mm == 0) print("00");
	else if(mm > 0 && mm < 10) printChar('0');
	printInt(mm);
	printChar('/');
	dd = BCD_decode(ch4);
	if(dd == 0) print("00");
	else if(dd > 0 && dd < 10) printChar('0');
	printInt(dd);
	print("\n\n");
}
コード例 #3
0
ファイル: db.c プロジェクト: carnil/nodau
/* convert a date string to a stamp */
static unsigned int db_getstamp(char* d)
{
    struct tm *timeinfo;
    /* if string is now, get current time */
    if (strcmp(d,"now") == 0) {
        return (unsigned int)time(NULL);
    }

    /* check datmask is set, if not create a temporary mask file */
    if (getenv("DATEMSK") == 0) {
        create_datemask();
    }

    /* get the stamp from the string */
    timeinfo = getdate(d);

    /* null means something went wrong, so print an error and return 'now' */
    if (timeinfo == NULL) {
        fprintf(stderr,"invalid date format\n");
        return db_getstamp("now");
    }

    /* convert the tm struct to a time_t */
    return mktime(timeinfo);
}
コード例 #4
0
void main (void)
{
   struct date data_atual;

   getdate(&data_atual);
   printf ("Data atual: %d-%d-%d\n", data_atual.da_day, data_atual.da_mon, data_atual.da_year);
}
コード例 #5
0
ファイル: funtime.c プロジェクト: ddf/pennmush
/** Convert a time string to a struct tm using getdate().
 * Formats for the time string are taken from the file referenced in
 * the DATEMSK environment variable.
 * \param str a time string.
 * \param ttm pointer to a struct tm to fill.
 * \retval 1 success.
 * \retval 0 failure.
 */
int
do_convtime_gd(const char *str, struct tm *ttm)
{
  /* converts time string to a struct tm. Returns 1 on success, 0 on fail.
   * Formats of the time string are taken from the file listed in the
   * DATEMSK env variable
   */
  struct tm *tc;

  tc = getdate(str);

  if (tc == NULL) {
#ifdef NEVER
    if (getdate_err <= 7)
      do_rawlog(LT_ERR, "getdate returned error code %d for %s", getdate_err,
                str);
#endif
    return 0;
  }

  memcpy(ttm, tc, sizeof(struct tm));
  ttm->tm_isdst = -1;

  return 1;
}
コード例 #6
0
ファイル: Unit1.cpp プロジェクト: lutes1/MIDPS
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
        gettime(&t);
        getdate(&d);
        sprintf(buff,"%02d-%02d-%4d %02d:%02d:%02d",d.da_day,d.da_mon,d.da_year,t.ti_hour,t.ti_min,t.ti_sec);
        Edit1->Text=AnsiString(buff);
        }
コード例 #7
0
ファイル: com_handler.c プロジェクト: Zargontapel/MPX-OS
void comhandle()
{
	serial_println("");
	serial_println("Welcome to the MPX OS.");
	serial_println("Feel free to begin entering commands.");
	serial_println("");
	while(1) {
		char *command = polling();
		if (!strcmpigncase(command, "Shutdown")) {
			if (shutdownConfirmed()) {
				serial_println("System shutting down...");
				break;
			} else {
				serial_println("Shutdown canceled.");
			}
		} else if (!strcmpigncase(command, "Version")) {
			version();
		} else if (!strcmpigncase(command, "Help")) {
			help();
		} else if (!strcmpigncase(command, "Setdate")) {
			setdate();
		} else if (!strcmpigncase(command, "Getdate")) {
			getdate();
		} else if (!strcmpigncase(command, "Settime")) {
			settime();
		} else if (!strcmpigncase(command, "Gettime")) {
			gettime();
		}
	}
}
コード例 #8
0
ファイル: Log.c プロジェクト: RealityFactory/Genesis3D-Tools
void Log_Timestamp(LogType *log)
{
#ifndef BORLANDC	// use a time function that will compile
	SYSTEMTIME	st;

	GetLocalTime( &st );
	Log_Output(log,"Current time is: %2.2d:%2.2d:%2.2d",
					 (int)st.wHour,
					 (int)st.wMinute,
					 (int)st.wSecond );
#else
	struct date thedate;
	struct time thetime;
 
	assert(log);
 
	getdate(&thedate);
	gettime(&thetime);
 
	Log_Output(log,"%d/%d/%d - %2.2d:%2.2d:%2.2d : ",
					 (int)thedate.da_mon,
					 (int)thedate.da_day,
					 (int)thedate.da_year,
					 (int)thetime.ti_hour,
					 (int)thetime.ti_min,
					 (int)thetime.ti_sec);
#endif
}
コード例 #9
0
ファイル: MSG.C プロジェクト: mdiiorio/ForceTen
inputheadinfo()				/* Input/Set header info for cur msg */
{
char s[80];
struct userfile tempu;

nl();
nl();
put("1Title:2 ");
input(hdr.title,50);
if(hdr.title[0]==0)
	{
	nl();
	pl("Post aborted");
	return(0);
	}

if(!hdr.prevrep)
	{
	nl();
	put("1To [All]:2 ");
	input(s,50);
	if(s[0]==0)
		{
		put("All");
		strcpy(hdr.to,"All");
		}
	}


sprintf(hdr.poster,"%s",user.name);
sprintf(hdr.posternote,"%s",user.note);
gettime(&hdr.posttime);
getdate(&hdr.postdate);
return(1);
}
コード例 #10
0
ファイル: transfiles.c プロジェクト: fuuccker/filetransfer
/* Make folder in '/home/<user>/transfers/' with actual date as name
 * @param fdout: file descriptor to write
 * @param client: client name
 *
 * @return: 0 on success. Error code otherwise
 */
int mkfolder(int fdout, char client[]) {
    char folder[BUF];
    char *name = NULL;
    char date[128];

    name = getlogin();
    getdate(date);
    sprintf(folder, "/home/%s/transfers/", name);

    if (mkdir(folder, 0700) < 0) {
        /* folder exists? */
        if (errno == 17) {
            sprintf(folder, "/home/%s/transfers/%s - %s/", name, date, client);
            dprintf(fdout, "\tCreating '%s'...\n", folder);
            mkdir(folder, 0700);
            chdir(folder);
            return 0;
        } else {
            dprintf(fdout, "ERROR%d\n", errno);
            return errno;
        }
    } else {
        dprintf(fdout, "\tCreating '%s'...\n", folder);
        mkdir(folder, 0700);
        sprintf(folder, "/home/%s/transfers/%s - %s/", name, date, client);
        dprintf(fdout, "\tCreating '%s'...\n", folder);
        mkdir(folder, 0700);
        chdir(folder);
        return 0;
    }
}
コード例 #11
0
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
        Edit2->Clear();
        Timer1->Enabled = true;
        Timer2->Enabled = false;
        Button1->Enabled = true;
        Button2->Enabled = false;
        Button3->Enabled = false;

        Button1->Hint = "Pornirea cronometrului";
        Button2->Hint = "Oprirea cronometrului";
        Button3->Hint = "Initializarea cronometrului";
        Button4->Hint = "Iesirea din program";

        Button1->ShowHint = true;
        Button2->ShowHint = false;
        Button3->ShowHint = false;
        Button4->ShowHint = true;

        char buf[20];
        getdate(&d);
        gettime(&t);

        sprintf(buf,"   %02d-%02d-%4d  %02d:%02d:%02d",d.da_day,d.da_mon,d.da_year,
        t.ti_hour, t.ti_min, t.ti_sec);
        
        Edit1->Text=(AnsiString)buf;
}
コード例 #12
0
ファイル: Call.cpp プロジェクト: raschupkin/TranslateNet
int PhoneCall::DBread(Connection *sqlCon)
{
	if (!sqlCon || !id)
		return -1;
	PreparedStatement *pstmt = sqlCon->prepareStatement(
			"SELECT phone, client, translator, client_country, translator_country, lang, price, start_time, accounted, cost, error, request_time, confirm_time, accepted FROM calls WHERE id=(?)");
	pstmt->setInt(1, id);
	ResultSet *res;
	try {
		res = pstmt->executeQuery();
	} catch (SQLException &ex) {
		log(LOG_ERROR, "[%s] MySQL error(%d): %s", __func__, ex.getErrorCode(), ex.what());
		delete pstmt;
		return 0;
	}
	delete pstmt;
	if (res->rowsCount() != 1)
		return -1;
	res->first();
	if (!res->getInt("phone")) {
		delete res;
		return -1;
	}
	client = res->getInt("client");
	translator = res->getInt("translator");
	translateLang = res->getString("lang").c_str();
	price = res->getInt("price");
	const char *time = res->getString("start_time").c_str();
	if (strlen(time) > 0)
		start_time = mktime(getdate(time));
	accounted = res->getInt("accounted");
	cost = res->getInt("cost");
	if (res->getInt("error"))
		state = ERROR;
	time = res->getString("request_time").c_str();
	if (strlen(time) > 0)
		request_time = mktime(getdate(time));
	time = res->getString("confirm_time").c_str();
	if (strlen(time) > 0)
		confirm_time = mktime(getdate(time));
	accepted = res->getBoolean("accepted");
	setClientCountry(res->getString("client_country").c_str());
	setTranslatorCountry(res->getString("translator_country").c_str());
	delete res;
	return 0;
}
コード例 #13
0
int isOlder(char *dob1, char *dob2)
{
    unsigned int d1 = 0, d2 = 0, m1 = 0, m2 = 0, y1 = 0, y2 = 0;
    if (!getdate(dob1, &d1, &m1, &y1) || !getdate(dob2, &d2, &m2, &y2))
    {
        return -1;
    }
    if (!check(d1, m1, y1) || !check(d2, m2, y2))
    {
        return -1;
    }
    if (y2 > y1)
    {
        return 1;
    }
    else if (y1 > y2)
    {
        return 2;
    }
    else
    {
        if (m2 > m1)
        {
            return 1;
        }
        else if (m1 > m2)
        {
            return 2;
        }
        else
        {
            if (d2 > d1)
            {
                return 1;
            }
            else if (d1 > d2)
            {
                return 2;
            }
            else
            {
                return 0;
            }
        }
    }
}
コード例 #14
0
ファイル: Hotel.CPP プロジェクト: akreddysoft/CollegeCode
void account :: prepare_bill(int t_billno)
{
	clrscr() ;
	struct date d;
	int d1, m1, y1 ;
	getdate(&d);
	d1 = d.da_day ;
	m1 = d.da_mon ;
	y1 = d.da_year ;
	float total=0.0, total_bill=0.0 ;
	gotoxy(33,3) ;
	cout <<"CUSTOMER BILL" ;
	gotoxy(32,4) ;
	cout <<"~~~~~~~~~~~~~~~" ;
	gotoxy(55,5) ;
	cout <<"Date:" <<d1 <<"/" <<m1 <<"/" <<y1 ;
	gotoxy(8,7) ;
	cout <<"ITEMS PURCHASED" ;
	gotoxy(8,8) ;
	cout <<"~~~~~~~~~~~~~~~" ;
	gotoxy(8,9) ;
	cout <<"Item code Item name            Cost    Price    Qty    Total" ;
	gotoxy(8,10) ;
	cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;
	int row=11 ;
	fstream file ;
	file.open("BILL.DAT", ios::in) ;
	file.seekg(0) ;
	while (file.read((char *) this, sizeof(account)))
	{
		if (billno == t_billno)
		{
			gotoxy(8,5) ;
			cout <<"BILL NO. # " <<billno ;
			gotoxy(8,6) ;
			cout <<"~~~~~~~~~~~~~~~" ;
			gotoxy(10,row) ;
			cout <<code ;
			gotoxy(18,row) ;
			cout <<name ;
			gotoxy(39,row) ;
			cout <<cost ;
			gotoxy(47,row) ;
			cout <<price ;
			gotoxy(56,row) ;
			cout <<quantity ;
			total = quantity * price ;
			gotoxy(63,row) ;
			cout <<total ;
			total_bill = total_bill + total ;
			row++ ;
		}
	}
	file.close() ;
	gotoxy(39,row+1) ;
	cout <<"TOTAL BILL: Rs." <<total_bill <<" /=" ;
	getch() ;
}
コード例 #15
0
void output_box_date_n_time(int check_if_end_needed=0)
{

textcolor(15);
gotoxy(5,2);putch(201);
for(int i=0;i<92;i++) putch(205);
putch(187);

for(i=3;i<8;i++)
{	gotoxy(5,i); putch(186); gotoxy(98,i); putch(186); }

gotoxy(5,8); putch(200);
for(i=0;i<92;i++) putch(205);
putch(188);

struct date d;
struct time t;

getdate(&d);
int day=d.da_day;
int mon=d.da_mon;
int year=d.da_year;

gettime(&t);
int hour=t.ti_hour;
int min=t.ti_min;

textcolor(12);
gotoxy(41,4); cputs(" TOURS AND TRAVELS SYSTEM ");
gotoxy(51,5);  //title

textcolor(11);
gotoxy(9,7);  cputs(" DATE  :  ");cprintf("%d",day);cputs("/");cprintf("%d",mon);cputs("/");cprintf("%d",year);
gotoxy(79,7); cputs(" TIME  :  ");cprintf("%d",hour);cputs(":");cprintf("%d",min);

textcolor(15);

if(check_if_end_needed==0)
{
gotoxy(5,9);putch(201);
for(int i=0;i<92;i++) putch(205);
putch(187);

for(i=10;i<43;i++)
{	gotoxy(5,i); putch(186); gotoxy(98,i); putch(186); }

gotoxy(5,43); putch(200);
for(i=0;i<92;i++) putch(205);
putch(188);
}

/*else
{
for(int i=8;i<43;i++)
{	gotoxy(2,i); putch(186); gotoxy(79,i); putch(186); }
}*/

}
コード例 #16
0
//---------------------------------------------------------------------------
void __fastcall TFChronometer::Timer1Timer(TObject *Sender)
{
char buf[25];
getdate(&d);
gettime(&t);
sprintf(buf,"%02d-%02d-%4d %02d:%02d:%02d",d.da_day,d.da_mon,d.da_year,
t.ti_hour,t.ti_min,t.ti_sec);
Edit1->Text=(AnsiString)buf;
}
コード例 #17
0
ファイル: Unit1.cpp プロジェクト: TurcanTudor/MIDPS-1
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
        char buffer[20];
        getdate(&data);
        gettime(&timp);
        sprintf(buffer,"%02d/%02d/%4d %2d:%02d:%02d", data.da_day, data.da_mon,
        data.da_year, timp.ti_hour, timp.ti_min, timp. ti_sec);
        Edit1->Text=(AnsiString)buffer;
}
コード例 #18
0
ファイル: Dosdate.c プロジェクト: d4nie1/TotulDespreCPP
void main(void)
 {
   struct date curr_date;

   getdate(&curr_date);

   printf("Current date: %d-%d-%d\n", curr_date.da_mon,
     curr_date.da_day, curr_date.da_year); 
 }
コード例 #19
0
ファイル: com_handler.c プロジェクト: Zargontapel/MPX-OS
void setdate()
{
    setyear();
    setmonth();
    setday();

    serial_print("Time successfully changed to -> ");
    getdate();
}
コード例 #20
0
ファイル: Unit1.cpp プロジェクト: theFaustus/MIDPS
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
        char buf[20];
        getdate(&d);
        gettime(&t);
        sprintf(buf," %02d-%02d-%4d %02d:%02d:%02d",d.da_day,d.da_mon,d.da_year,
        t.ti_hour,t.ti_min,t.ti_sec);
        CurrentTime->Text=(AnsiString)buf;

}
コード例 #21
0
ファイル: date.c プロジェクト: Hiroki11x/xv6-public
int main(void) {
 struct rtcdate d;
 if (getdate(&d) < 0)
 printf(2, "Error: getdate failed\n");
 else
 printf(1, "%d:%d:%d %d/%d/%d\n",
 d.hour, d.minute, d.second,
 d.month, d.day, d.year);
 exit();
}
コード例 #22
0
ファイル: DT_EVENT.CPP プロジェクト: benbucksch/AppWare
extern "C" void CALLBACK /*!!PORT!! was _far_ _pascal_*/  DateEvent_dateUpdate(pAEvtInfo theEvent, pAObjMessage theSystem)
{
	
	BOOL          keepCurrentExists = FALSE;
  OBJECTID      oiDate;
  LPDate  			date;
  DATE          systemDate, objectDate;
  AEvtInfo   	  event;
	long					cookie = 	AOBJ_GETFIRSTKEY;

	I_UNUSED(theEvent); 
	I_UNUSED(theSystem);

  getdate(&systemDate);

	while ((oiDate = AObjGetNextObject(OTYPE_DATE, &cookie)) != 0)
  {
   	date = LockDateObject(oiDate);
    if (date->IsKeepCurrent())
    {
      keepCurrentExists = TRUE;
      objectDate = JulianToDate(date->GetDateValue());
      if (memcmp(&objectDate, &systemDate, sizeof(DATE)))
      {
        //changedSignal is posted by the method that listens for ObjectChanged
          if (systemDate.da_year != objectDate.da_year)
						AEvtPostSignalAtTail(oiDate, DT_SignalYearChanged);

          if (systemDate.da_mon != objectDate.da_mon)
						AEvtPostSignalAtTail(oiDate, DT_SignalMonthChanged);

          if (systemDate.da_day != objectDate.da_day)
						AEvtPostSignalAtTail(oiDate, DT_SignalDayChanged);
			}

      //changedSignal is posted by the method that listens for ObjectChanged
					date->SetDateValue(DateToJulian(systemDate), TRUE); // Get the date value and post the changed signal
		}
		UnlockDateObject(oiDate);
  }

  if (keepCurrentExists)
  {
    event.sourceObject = 0;
    event.targetObject = 0;
    event.when         = JulianToTickCount(DateToJulian(systemDate)+1);
    event.how          = AEVT_ATTAIL | AEVT_KILLSIMILARS | AEVT_KILLALLQUEUES;
    event.what         = ODATE_EVT_DATEUPDATE;

//    event.what         = dateUpdate;
    event.details      = 0L;
    event.modifiers    = 0L;
    AEvtPost(&event);
  }
}
コード例 #23
0
ファイル: TakeMoneyDlg.cpp プロジェクト: boyuanH/Bank
void CTakeMoneyDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if(m_Amount<=0)
	{
		AfxMessageBox("取款额小于等于0,无法取款");
		return;
	}
	//获取系统时间
	//修改account表中的余额,并添加depositor表中的存款记录
	CADOConn m_ADOConn;
	_RecordsetPtr m_pRecordset;
	m_ADOConn.OnInitADOConn();

	_bstr_t balanceSQL,depSQL,preBalance,custID;
	//取出先前的余额
	_variant_t theValue;
	double balance;
	CString strBalance;
	preBalance="select * from account where account_number='"+g_CustomerID+"'";
	m_pRecordset=m_ADOConn.GetRecordset(preBalance);	
	theValue=m_pRecordset->GetCollect("balance");
	if(theValue.vt!=VT_NULL)
		strBalance=(char *)_bstr_t(theValue);
	balance=atof(strBalance);
	balance-=m_Amount;//余额减去取款额为新的余额
	if(balance<0)
		AfxMessageBox("余额不足,无法取款!");
	else
	{
		CString strA;
		strA.Format("%f",balance);
		balanceSQL="update account set balance='"+strA+"' where\
			account_number='"+g_CustomerID+"'";
		m_ADOConn.ExecuteSQL(balanceSQL);
		//查询客户id
		custID="select distinct customer_id from account,depositor where account.account_number=\
			depositor.account_number";
		m_pRecordset=m_ADOConn.GetRecordset(custID);	
		theValue=m_pRecordset->GetCollect("customer_id");
		CString m_CustomerId;
		if(theValue.vt!=VT_NULL)
			m_CustomerId=(char *)_bstr_t(theValue);
		//添加存款记录
		strA.Format("%f",m_Amount);
		depSQL="insert into depositor(account_number,customer_id,account_type,access_date,amount)\
			values('"+g_CustomerID+"','"+m_CustomerId+"','take',\
			convert(varchar,getdate(),120),'"+strA+"')";//获取系统时间
		m_ADOConn.ExecuteSQL(depSQL);
		AfxMessageBox("取款成功!");
	}
	m_ADOConn.ExitConnect();
	CDialog::OnOK();
}
コード例 #24
0
void _FARFUNC ftime(struct timeb _FAR *TimeStructPtr)
{
    struct date DosDate, Vdate;
    struct time DosTime;

    tzset(); /* Get timezone info. */

    /*
       Because there is a window of vulnerability at exactly midnight when
       calling getdate(INT 21 fn 2A) and gettime(INT 21 fn 2C) in succession,
       we do 2 calls to getdate() to ensure we aren't in this window.
    */
    do
    {
        getdate(&DosDate);
        gettime(&DosTime);
        getdate(&Vdate);
    }
    while ( (DosDate.da_year != Vdate.da_year) ||
                (DosDate.da_day  != Vdate.da_day)  ||
                (DosDate.da_mon  != Vdate.da_mon) );

    /*
       Convert extern 'timezone's seconds to structure 'timezone's minutes.
       Set daylight savings indicator.
       Convert DOS date and time to UNIX style time and store in structure.
       Set milliseconds structure field. DOS is only accurate to 100ths of a
          second so (100ths * 10) makes 1000ths.
    */
#if defined(_RTLDLL)
        TimeStructPtr->_timezone = (short)(timezone / 60L);
#else
        TimeStructPtr->timezone = (short)(timezone / 60L);
#endif
    if (daylight && __isDST( DosTime.ti_hour, DosDate.da_day,
                                 DosDate.da_mon,  DosDate.da_year-1970) )
        TimeStructPtr->dstflag  = 1;
    else
        TimeStructPtr->dstflag  = 0;
    TimeStructPtr->time     = dostounix(&DosDate, &DosTime);
    TimeStructPtr->millitm  = DosTime.ti_hund * 10;
}
コード例 #25
0
void fecha(void)
{
  struct date d;
  int dia,mes,agno;
  getdate(&d);
  dia=d.da_day;
  mes=d.da_mon;
  agno=d.da_year;
    gotoxy(2,5);
  printf("%d/%d/%d",dia,mes,agno);
}
コード例 #26
0
ファイル: lab1Bp3.cpp プロジェクト: EugeniuBraga/MIDPS
//---------------------------------------------------------------------------
void __fastcall TForm1::DateTimer1Timer(TObject *Sender)
{
        char buff[20];
        getdate(&date_);
        gettime(&time_);
        sprintf(buff, "%02d-%02d-%04d  %02d:%02d:%02d",
                date_.da_day, date_.da_mon, date_.da_year,
                time_.ti_hour, time_.ti_min, time_.ti_sec);

        Edit1->Text = (AnsiString)buff;
}
コード例 #27
0
ファイル: AS_FTIME.C プロジェクト: zzheads/SpectrumAnalyzer
void earnftime (FTIME *t)
/***********
* Describe : Устанавливает в t системное время
* Params   : FTIME *t - куда писать время
* Return   : void
* Call     :
***********/
{
 getdate (&(t->date));                        /* системная дата              */
 gettime (&(t->time));                        /* системное время             */
}
コード例 #28
0
int main()
{
	struct date *dt;

  getdate(&dt);

   printf("Operating system's current date is %d-%d-%d\n",
	 dt.da_day, dt.da_mon, dt.da_year);

   return 0;
}
コード例 #29
0
ファイル: com_handler.c プロジェクト: Zargontapel/MPX-OS
void comhandle()
{
	serial_println("");
	serial_println("Welcome to the MPX OS.");
	serial_println("Feel free to begin entering commands.");
	serial_println("");
	while(1) {
		char *command = polling();
		if (!strcmpigncase(command, "shutdown")) {
			if (shutdownConfirmed()) {
				serial_println("System shutting down...");
				clearAllQueues();
				break;
			} else {
				serial_println("Shutdown canceled.");
			}
		} else if (!strcmpigncase(command, "version")) {
			version();
		} else if (!strcmpigncase(command, "help")) {
			help();
		} else if (!strcmpigncase(command, "setdate")) {
			setdate();
		} else if (!strcmpigncase(command, "getdate")) {
			getdate();
		} else if (!strcmpigncase(command, "settime")) {
			settime();
		} else if (!strcmpigncase(command, "gettime")) {
			gettime();
		} else if (!strcmpigncase(command, "suspend")) {
			suspendPCB();
		} else if (!strcmpigncase(command, "resume")) {
			resumePCB();
		} else if (!strcmpigncase(command, "setpriority")) {
			setPriority();
		} else if (!strcmpigncase(command, "showPCB")) {
		        showPCB();
		} else if (!strcmpigncase(command, "showReady")) {
		        showReady();
		} else if (!strcmpigncase(command, "showBlocked")) {
		        showBlocked();
		} else if (!strcmpigncase(command, "showAll")) {
		        showAll();
		} else if (!strcmpigncase(command, "yield")) {
		        asm volatile ("int $60");
		        serial_println("");
		} else if (!strcmpigncase(command, "loadr3")) {
		        loadR3();
		} else if (strcmp(command, '\0')) {
			serial_println("Command not recognized. Type help to view commands.");
			serial_println("");
		}
		sys_free_mem(command);
	}
コード例 #30
0
const Date & Date::Today()
{
        struct date sDate;
        getdate(&sDate);

	month = sDate.da_mon;
	day   = sDate.da_day;
	year  = sDate.da_year;

	mdy_to_julian();
	return *this;
}