This blog is under construction

Saturday 5 May 2012

gmtime example in C

Header file:
    time.h

Synopsis:
     struct tm *gmtime(const time_t *t1);

Description:
     It converts the calendar time t1 into UTC/GMT.


gmtime function C example:



  #include<stdio.h>
  #include<time.h>
  int main() {
        time_t tp;
        struct tm *t;
        char *str;
        tp = time(NULL);
        t = gmtime(&tp);
        str = asctime(t);
        printf("GMT:\n%s", str);
        str = ctime(&tp);
        printf("IST:\n%s", str);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/cpgms/time$ ./a.out
  GMT:
  Sat May  5 18:20:10 2012
  IST:
  Sat May  5 23:50:10 2012





1 comment:

  1. Do you need Finance? Are you looking for Finance? Are you looking for finance to enlarge your business? We help individuals and companies to obtain finance for business expanding and to setup a new business ranging any amount. Get finance at affordable interest rate of 3%, Do you need this finance for business and to clear your bills? Then send us an email now for more information contact us now via (financialserviceoffer876@gmail.com) whats-App +918929509036 Dr James Eric Finance Pvt Ltd Thanks

    ReplyDelete