time access in C

I've a problem with time functions in C. I get current time and convert it to local time and gmt time. But their value seems to be same.I think I'm missing something..

#include <stdio.h>
#include <memory.h>
#include <time.h>

int main()
{
        time_t now_local, now_gmt;
        now_local = time(NULL);
        const char* local_now_str = ctime(&now_local);
        printf("local time: %s\n", local_now_str);

        now_gmt = time(NULL);
        const char* gmt_now_str = asctime( gmtime( &now_gmt ) );
        printf("gmt time  : %s\n", gmt_now_str);

        printf("diff      : %d\n", (int)(now_local-now_gmt));
}

Output:

local time: Thu Jul 22 13:53:05 2010

gmt time : Thu Jul 22 10:53:05 2010

diff : 0

gmtime() converts epoch seconds to a struct tm that represents GMT time/date
ctime() implicitly calls localtime - it made a struct tm three hours "faster" than gmtime because of your timezone setting.
-- using the same epoch time.

Your timezone setting is 3 hours East of the zero meridian. How you set the timezone affects the output of ctime. gmtime is not affected by timezone settings.

What OS are you on? that affects how you show and set current TZ settings.

This will display the offset in hours:

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

int main()
{
   time_t now_local, now_gmt;
   time_t t1, t2;
   struct tm tm1, tm2;
   char local_now_str[50];
   char gmt_now_str[50];

   now_local = time(NULL);
   now_gmt = time(NULL);

   strcpy(local_now_str, ctime(&now_local));
   strcpy(gmt_now_str, asctime(gmtime(&now_gmt)));

   strptime(local_now_str, "%c", &tm1);
   strptime(gmt_now_str, "%c", &tm2);

   t1 = mktime(&tm1);
   t2 = mktime(&tm2);

   printf("local time: %s", local_now_str);
   printf("GMT time  : %s", gmt_now_str);
   printf("Offset    : %d hrs\n", (int)difftime(t2, t1)/3600);
}