How to get the current time in London with C

1 Answer

0 votes
#include <stdio.h>      
#include <time.h>      

#define BST +1

int main(void) {
  time_t timet;
  struct tm *p;

  time (&timet);
  p = gmtime(&timet);

  printf("London Time: %2d:%02d\n", (p->tm_hour + BST) % 24, p->tm_min);

  return 0;
}
  
  
  
/*
run:
  
London Time:  8:56
  
*/

 



answered Jun 13, 2020 by avibootz
edited Jun 13, 2020 by avibootz

Related questions

1 answer 116 views
1 answer 99 views
1 answer 175 views
1 answer 245 views
1 answer 202 views
1 answer 202 views
1 answer 149 views
...