示例#1
0
/* Outputs - Calculated Times and Charges */
int printReceipt (void)
{
  int hhIn, mmIn;
  int hhOut, mmOut;
  printf("\nParking Receipt\n");
  printf("Time IN: %d:%d\n", hhIn, mmIn);
  printf("Time OUT: %d:%d\n", hhOut, mmOut);
  printf("Total Time is: %d hours, %d minutes\n", calculateTime(hhIn, mmIn, hhOut, mmOut));
  printf("Total Charge: $", "%.2f\n", calculateCharges(calculateTime(hhIn, mmIn, hhOut, mmOut));
  printf("--------------------------------\n");

  return 0;
};
示例#2
0
void Jmplayer::showTime()
{
    ms = ms + 1;
    if(ms>=filesInfos.at(fileIndex).length){
        ms = 0;
        timeSlider->setValue(ms);
        if (fileIndex < filesList2.size()-1)
        {
            fileIndex++;            
            timer->start(1000);
            init();
        }
        else
        {
            fileIndex = 0;
            timer->stop();
            running = false;
            firstTime = true;
            fileIndex = 0;
            play_button->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
            initFiles();
        }
       
        
    }    
    timePlay->setText(calculateTime(ms));
}
示例#3
0
文件: player.cpp 项目: jabouzi/qsalat
// set player label text
void Player::setLabel()
{
    QString filename = videoPlayer->mediaObject()->currentSource().fileName();
    filename = filename.right(filename.length() - filename.lastIndexOf('/') - 1);
    //this->setWindowTitle(filename);    
    lengthLabel->setText(calculateTime(videoPlayer->mediaObject()->totalTime()));
    timeSlider->setRange(0,videoPlayer->mediaObject()->totalTime());
    volumeSlider->setRange(0,100);
    volumeSlider->setValue(videoPlayer->volume()*100);    
}
示例#4
0
void Jmplayer::init()
{
    timeSlider->setRange(0, filesInfos.at(fileIndex).length);    
    volumeSlider->setRange(0,100);
    volumeSlider->setValue(100);
    timePlay->setText("00:00:00"); 
    totalTime->setText(calculateTime(filesInfos.at(fileIndex).length));
    QStringList templist = filesList2.at(fileIndex).split("/");
    QString filename = templist[templist.size()-1];
    setWindowTitle(filename);
}
int main(){
    int *data = (int *)malloc(sizeof(int) * (1 << WRITE_DATA_SIZE));
    int *data1 = (int *)malloc(sizeof(int) * (1 << WRITE_DATA_SIZE));
    int i;
    for(i = 1 ; i <= 3;i++){
        //memset(data,0,(1 << WRITE_DATA_SIZE));
        readData(data1,0,(1<<WRITE_DATA_SIZE));
        printf("\n");
        calculateTime(data,i);
        printf("\n");
    }
    return 0;
}
示例#6
0
int main (void)
{
  int hhIn, mmIn;
  int hhOut, mmOut;
  printf("Enter time IN: ");
  scanf("%d:%d", &hhIn, &mmIn);	/* */

  printf("\nEnter time OUT: ");
  scanf("%d:%d", &hhOut, &mmOut);	/* */

  calculateTime(hhIn, mmIn, hhOut, mmOut);

  printReceipt();

  return 0;
};
示例#7
0
int main(int argc, char **argv)
{
	ParametersType *Parameters;
	MatrixDataType *MatrixData;
	FemStructsType *FemStructs;
	FemFunctionsType *FemFunctions;
	FemOtherFunctionsType *FemOtherFunctions;
	struct timespec Start, End;
	double Preprocess_Time, Process_Time, Postprocess_Time;


	/* ******************************************************* Preprocess ****************************************************** */
	clock_gettime(CLOCK_MONOTONIC, &Start);
	Preprocess(argc, argv, &Parameters, &MatrixData, &FemStructs, &FemFunctions, &FemOtherFunctions);
	clock_gettime(CLOCK_MONOTONIC, &End);
	Preprocess_Time = End.tv_sec - Start.tv_sec + 1e-9*(End.tv_nsec - Start.tv_nsec);
	/* ************************************************************************************************************************* */

	/* ******************************************************** Process ******************************************************** */
	clock_gettime(CLOCK_MONOTONIC, &Start);
	Process(Parameters, MatrixData, FemStructs, FemFunctions, FemOtherFunctions);
	clock_gettime(CLOCK_MONOTONIC, &End);
	Process_Time = End.tv_sec - Start.tv_sec + 1e-9*(End.tv_nsec - Start.tv_nsec);
	/* ************************************************************************************************************************* */

	/* ******************************************************* Postprocess ***************************************************** */

	clock_gettime(CLOCK_MONOTONIC, &Start);
	Postprocess(Parameters, MatrixData, FemStructs, FemFunctions, FemOtherFunctions);
	clock_gettime(CLOCK_MONOTONIC, &End);
	Postprocess_Time = End.tv_sec - Start.tv_sec + 1e-9*(End.tv_nsec - Start.tv_nsec);

	/* ************************************************************************************************************************* */

	/* ******************************************************* Total Time ****************************************************** */
	calculateTime(Preprocess_Time, Process_Time, Postprocess_Time, Parameters);
	/* ************************************************************************************************************************* */

	free(Parameters);
	
	return 0;
}
示例#8
0
int main(){
    int *data1 = (int *)malloc(sizeof(int) * (1 << WRITE_DATA_SIZE));
    int i;
    printf("***************************************\n");
    printf("result for read one integer 10000 times\n");
    printf("***************************************\n");
    for(i = 1 ; i <= 8;i++){
        void *p;
        int *data_i ;
        p = malloc(sizeof(int) * (1 <<WRITE_DATA_SIZE)+32);
        unsigned adj;
        adj = 32 - ((unsigned)p%32);
        p = p +adj;
        data_i = (int *) p;

        memset(data_i,0,(1 << WRITE_DATA_SIZE));
        memset(data1,0,(1 << WRITE_DATA_SIZE));

        calculateTime(data_i,i);
    }
    return 0;
}
示例#9
0
int main(){
    int *data1 = (int *)malloc(sizeof(int) * (1 << WRITE_DATA_SIZE));
    int i;
    for(i = 1 ; i <= 3;i++){
        void *p;
        int *data_i ;
        p = malloc(sizeof(int) * (1 <<WRITE_DATA_SIZE)+64);
        unsigned adj;
        adj = 32 - ((unsigned)p%32);
        p = p +adj;
        data_i = (int *) p;

        memset(data_i,0,(1 << WRITE_DATA_SIZE));
        memset(data1,0,(1 << WRITE_DATA_SIZE));

        //readData(data_i,0,(1<<WRITE_DATA_SIZE));
        printf("\n");
        calculateTime(data_i,i);
        printf("\n");
    }
    return 0;
}
示例#10
0
/*******************

Een gps track afleggen: elke node overlopen.

*******************/
void followTrack() {
    int millisec = 0;
    for(nodeNumber=0; nodeNumber<aantal_nodes; nodeNumber++) {

        // Stel de holdtime in
        millisec = calculateTime(track[nodeNumber].distance,track[nodeNumber].max_speed );

        /*Richtingsaanwijzer*/
        switch(track[nodeNumber].dir) {
        case forward:
//#ifdef TESTMODE
            printf("Move forward\n");
//#else
            moveForward();
//#endif
            break;
        case left:
//#ifdef TESTMODE
            printf("Turn left\n");
//#else
            moveLeft();
//#endif
            break;
        case right:
//#ifdef TESTMODE
            printf("Turn right\n");
//#else
            moveRight();
//#endif
            break;
        case backward:
//#ifdef TESTMODE
            printf("Reverse\n");
//#else
            moveForward();
            speed(-1);
//#endif
            break;
        default:
//#ifdef TESTMODE
            printf("Default: Stand still\n");
//#else
            moveForward();
            speed(0);
//#endif
        }

#ifndef TESTMODE
        /*Snelheidsaanduider*/
        speed(track[nodeNumber].max_speed);
        printf("De snelheid is %d\t%d\n",track[nodeNumber].max_speed,nodeNumber);
#endif
        /*Kilometerteller*/
        totalDistance += (int)(track[nodeNumber].distance/1000);
        state_of_charge -= specs.capacity/100;
#ifdef TESTMODE
        printf("Drive %d m at %d m/s = %d ms\n\n",track[nodeNumber].distance/1000, track[nodeNumber].max_speed, calculateTime(track[nodeNumber].distance, track[nodeNumber].max_speed));
#endif

        // Stop de lus voor de bepaalde tijd
        usleep(millisec*1000);
    }
}
示例#11
0
int main(){
    int i;
    for(i = 0;i< LOOPNUMBER;i++)
        calculateTime();
        return 1;
}
示例#12
0
int main(){
        long cacheLength = pow(2,(double)14);// length = 16K
        calculateTime(cacheLength);
        return 1;
}