fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4.  
  5. // convert a timeval and time to milliseconds of today
  6. int seconds_of_day(struct timeval *sec, struct tm *tim){
  7. long int milli_since_epoch = (sec->tv_sec * 1000)+(sec->tv_usec/100);
  8. return 0; // this is return 0 only for debugging
  9. }
  10.  
  11. int main(){
  12. struct timeval timeval_struct;
  13. time_t rawtime;
  14. struct tm *tm_struct;
  15.  
  16. gettimeofday(&timeval_struct, NULL);
  17. time(&rawtime);
  18. tm_struct = gmtime(&rawtime);
  19.  
  20. int milli = seconds_of_day(&timeval_struct, tm_struct);
  21. return(0);
  22. }
Success #stdin #stdout 0s 1916KB
stdin
Standard input is empty
stdout
Standard output is empty