Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

localtime()

Name: Anonymous 2007-12-27 8:38

Hi everyone, im looking for source of the localtime() function as well as the time() function [C] as i wish to know how it converts a four figures char into a struct with 7 int values?

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

int main ()
{
  char cha[]="X5r6";
  struct tm * timeinfo;
  timeinfo = localtime ( &cha );
   printf("%s",asctime (localtime ( &cha )));
  //How does X5r6 turn into this ?
   printf("%d %d %d %d %d %d %d\n",timeinfo->tm_wday,
        timeinfo->tm_mon,
        timeinfo->tm_mday, timeinfo->tm_hour,
        timeinfo->tm_min, timeinfo->tm_sec,
        1900 + timeinfo->tm_year);
  return 0;
}

Name: Anonymous 2007-12-27 11:22

mkdir libc6-src
cd libc6-src
apt-get source libc6
cd glibc-2*
tar xjvf glibc-2*
cd glibc-2*/time
grep ^localtime *

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List