Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. while( (read_size = recv(client_sock , client_message , 107 , 0)) > 0 )
  2. {
  3. //curr_hour = (info->tm_hour)%24;
  4. //curr_mon = ((info->tm_mon)%12)+1;
  5.  
  6.  
  7. curr_hour=(info->tm_hour)%24;
  8. curr_day=(info->tm_mday)%31;
  9. strftime(curr_day1,3,"%d", info);
  10. strftime(curr_mon,3,"%m", info);
  11. curr_year=(info->tm_year)+1900;
  12. strftime(curr_hour1,3,"%H", info);
  13. printf("Before first if : %s%d%s%s%s%s%s%s%s\n",path,curr_year,"-",curr_mon,"-",curr_day1,"-",curr_hour1,".log");
  14.  
  15. if (start_hour < curr_hour || (curr_hour+start_hour) == start_hour ) {fclose (fp0);
  16. puts("First IF worked");
  17. sprintf(filename1,"%s%d%s%s%s%s%s%s%s",path,curr_year,"-",curr_mon,"-",curr_day1,"-",curr_hour1,".log");
  18. puts("sprintf worked");
  19. if ((curr_hour + start_hour) == start_hour){start_hour=0;}
  20. else
  21. {
  22. start_hour++;
  23. puts ("Increment start_hour");
  24. }
  25. puts ("Open filename1");
  26. fp0 = fopen(filename1,"a");
  27. }
  28.  
  29. printf ("Start_Hour:%d, Current_Hour:%d\n",start_hour,curr_hour);
  30. fprintf(fp0, "%s", client_message);
  31. fflush(fp0);
  32. printf ("%s", client_message);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement