Welcome to pickSourcecode.com Login | Register    
pickZy.com
 Home  | search  | games  | General  | C  | C++  | Java  | Php  | Networking  | Visual Basic  | VC++  | Win32  | MFC  | JavaScript  | Jobs  | JavaScript  | Post jobs
C - time_t gmtime example       Share
2007-11-03 |  RatheeshTR  | Viewed: 1893  |    0

/*  gmtime  example  */

/*

m_sec  seconds  after  the  minute      0-61
tm_min  minutes  after  the  hour        0-59
tm_hour  hours  since  midnight        0-23
tm_mday  day  of  the  month        1-31
tm_mon  months  since  January        0-11
tm_year  years  since  1900
tm_wday  days  since  Sunday        0-6
tm_yday  days  since  January  1        0-365
tm_isdst  Daylight  Saving  Time              flag

int  tm_sec;
int  tm_min;
int  tm_hour;
int  tm_mday;
int  tm_mon;
int  tm_year;
int  tm_wday;
int  tm_yday;
int  tm_isdst;

*/


/*  gmtime  example  */
#include <stdio.h>
#include <time.h>

#define MST (-7)
#define UTC (0)
#define CCT (+8)

int main ()
{

  time_t rawtime;

  tm * ptm;


  time ( &rawtime );


  ptm = gmtime ( &rawtime );


  puts ("Current time around the World:");

  printf ("Phoenix, AZ (U.S.) :  %2d:%02d\n", (ptm->tm_hour+MST)%24, ptm->tm_min);

  printf ("Reykjavik (Iceland) : %2d:%02d\n", (ptm->tm_hour+UTC)%24, ptm->tm_min);

  printf ("Beijing (China) :     %2d:%02d\n", (ptm->tm_hour+CCT)%24, ptm->tm_min);

  

  return 0;

}


Latest topics
C - pointers to pointers  Viewed: 263
Malloc Debugger  Viewed: 263
C - switch statement  Viewed: 264
C - binary tree  Viewed: 264
Is a prime number or not  Viewed: 264
C - Do while  Viewed: 265
C - Global variables , static variables  Viewed: 265
C - binsearch  Viewed: 265
C Assign content to a function pointer  Viewed: 265
C - Structure example  Viewed: 266

Comments:





Submit comment's

Type:

User Comment's:

Submitted By:
Prof: Software Engineer
Tech: C ,Cpp
Send Mail: ratheesh



Related topics
C - Data Structure,Rev Linked list
C - Data Structure,linked list
C - time_t strftime example
C - time_t gmtime example
C - enum example
C - strtok example, Splitting string into tokens
C - libxml2 parsing example libxml
C - if else example
C - Structure example
C - pointers and arrays example strlen
C - Pointers to structures
C - gtk scrolled window example
C - Binary Search Tree example
C TCP socket example Server and Client program
C UDP socket example Server and Client program

Related References
c - basics of structure
c - functions and program structure, programmed pass-by-reference via pointers, pass-by-reference parameters
c - structures and functions
c - arrays of structures
c - pointers to structures
explain function pointers with examples?

Web site contents © Copyright 2007, All rights reserved.
Help | Terms and Conditions | Privacy Policy | About Us