[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wierd output concerning time.h

From: daniel
Subject: wierd output concerning time.h
Date: Wed, 18 Jan 2006 23:49:20 -0500
User-agent: KMail/1.6.1


The program I am trying to make is a simple timer. It uses the sleep function 
to calculate the appropriate amount of time. 

Initially, I developed it on Windows and everything worked fine. However when 
I came to run it on Linux, after a certain point it froze. I isolated the 
problem to just a few lines of code but i cant work out why its having 
trouble recording the current time properly. 

Any help would be greatly appreciated.

Below is the source code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

char line[100];

int flag = 0;
int i = 0;
int end_point = 10;
int begin;
int end;
int input1;
int input2;
int indicator; 

int main() {

          time_t begin;
          input1 = ctime(&begin);
   while (1) {
        printf("%d\n", i);   
        if (i == end_point) 
          time_t end;
          input2 = ctime(&end);
          printf("%s", input1);
          printf("\n%s\n", input2);
    return 0;

Regards, Daniel

Attachment: timer
Description: application/executable

reply via email to

[Prev in Thread] Current Thread [Next in Thread]