What's wrong with this code?
In the following code a strange thing is happening. The function get_time_in_seconds(), a custom function I have built and tested independently, works fine when called directly from inside the long printf statement. However, it does not store the expected value when I assign it to the variable curr_time2. Any guesses why?

	while (1)
	{
		count++;
		bytes_read = recvfrom(sock,recv_data,1024,0,(struct sockaddr *)&client_addr, (socklen_t*)&addr_len);
	  recv_data[bytes_read] = '\0';
	  strcpy(buff,inet_ntoa(client_addr.sin_addr));
		printf("\nAt %lf (%s , %d, Num : %d) said : ",get_time_in_seconds(),buff,ntohs(client_addr.sin_port),get_id(buff));
		printf("%s", recv_data);
		curr_time2=get_time_in_seconds();
		printf("%lf\n",curr_time2);
    //		data.nodeid=get_id(buff);
    //		data.time = curr_time2;
		//printf("%f,%f\n",data.time,curr_time2);
		store_packetdata(&data);
		fflush(stdout);
	}

Sample output:

> At 1303829191.827888 (10.22.6.162 ,
> 35355, Num : 1) said : 505
> 1303829248.000000
> 
> At 1303829196.827893 (10.22.6.162 ,
> 35355, Num : 1) said : 506
> 1303829248.000000
> 
> At 1303829201.827898 (10.22.6.162 ,
> 35355, Num : 1) said : 507
> 1303829248.000000
> 
> At 1303829206.827903 (10.22.6.162 ,
> 35355, Num : 1) said : 508
> 1303829248.000000
> 
> At 1303829211.827908 (10.22.6.162 ,
> 35355, Num : 1) said : 509
> 1303829248.000000
> 
> At 1303829216.827913 (10.22.6.162 ,
> 35355, Num : 1) said : 510
> 1303829248.000000
> 
> At 1303829221.827918 (10.22.6.162 ,
> 35355, Num : 1) said : 511
> 1303829248.000000
> 
> At 1303829226.827923 (10.22.6.162 ,
> 35355, Num : 1) said : 512
> 1303829248.000000
> 
> At 1303829231.827928 (10.22.6.162 ,
> 35355, Num : 1) said : 513
> 1303829248.000000

At 1303829236.827933 (10.22.6.162 , 35355, Num : 1) said : 514
1303829248.000000

At 1303829241.827938 (10.22.6.162 , 35355, Num : 1) said : 515
1303829248.000000

What's wrong with this code?
===

In the following code a strange thing is happening. The function get_time_in_seconds(), a custom function I have built and tested independently, works fine when called directly from inside the long printf statement. However, it does not store the expected value when I assign it to the variable curr_time2. Any guesses why?

	while (1)
	{
		count++;
		bytes_read = recvfrom(sock,recv_data,1024,0,(struct sockaddr *)&client_addr, (socklen_t*)&addr_len);
	  recv_data[bytes_read] = '\0';
	  strcpy(buff,inet_ntoa(client_addr.sin_addr));
		printf("\nAt %lf (%s , %d, Num : %d) said : ",get_time_in_seconds(),buff,ntohs(client_addr.sin_port),get_id(buff));
		printf("%s", recv_data);
		curr_time2=get_time_in_seconds();
		printf("%lf\n",curr_time2);
    //		data.nodeid=get_id(buff);
    //		data.time = curr_time2;
		//printf("%f,%f\n",data.time,curr_time2);
		store_packetdata(&data);
		fflush(stdout);
	}

Sample output:

> At 1303829191.827888 (10.22.6.162 ,
> 35355, Num : 1) said : 505
> 1303829248.000000
> 
> At 1303829196.827893 (10.22.6.162 ,
> 35355, Num : 1) said : 506
> 1303829248.000000
> 
> At 1303829201.827898 (10.22.6.162 ,
> 35355, Num : 1) said : 507
> 1303829248.000000
> 
> At 1303829206.827903 (10.22.6.162 ,
> 35355, Num : 1) said : 508
> 1303829248.000000
> 
> At 1303829211.827908 (10.22.6.162 ,
> 35355, Num : 1) said : 509
> 1303829248.000000
> 
> At 1303829216.827913 (10.22.6.162 ,
> 35355, Num : 1) said : 510
> 1303829248.000000
> 
> At 1303829221.827918 (10.22.6.162 ,
> 35355, Num : 1) said : 511
> 1303829248.000000
> 
> At 1303829226.827923 (10.22.6.162 ,
> 35355, Num : 1) said : 512
> 1303829248.000000
> 
> At 1303829231.827928 (10.22.6.162 ,
> 35355, Num : 1) said : 513
> 1303829248.000000

At 1303829236.827933 (10.22.6.162 , 35355, Num : 1) said : 514
1303829248.000000

At 1303829241.827938 (10.22.6.162 , 35355, Num : 1) said : 515
1303829248.000000
