<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting date and time from from time.h in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115264#M92807</link>
    <description>Hi All,&lt;BR /&gt;&lt;BR /&gt; Yes, i missed struct there.&lt;BR /&gt;&lt;BR /&gt;  I am also able to achieve this by following 2 lines of code&lt;BR /&gt;&lt;BR /&gt;  #include &lt;TIME.H&gt;&lt;BR /&gt;  long t = time(0);&lt;BR /&gt;  cout &amp;lt;&amp;lt; asctime(localtime(&amp;amp;t))&amp;lt;&lt;ENDL&gt;&lt;/ENDL&gt;&lt;BR /&gt;thanks and regards&lt;BR /&gt;Vikram&lt;/TIME.H&gt;</description>
    <pubDate>Thu, 13 Dec 2007 08:57:23 GMT</pubDate>
    <dc:creator>CA1490051</dc:creator>
    <dc:date>2007-12-13T08:57:23Z</dc:date>
    <item>
      <title>Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115258#M92801</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;     I want to get the system date and time i am tryong man pages of local time&lt;BR /&gt;&lt;BR /&gt;    Here is my code&lt;BR /&gt;  #include &lt;TIME.H&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;  tm TimeNow;&lt;BR /&gt;   char *pTime = localtime(&amp;amp;TimeNow);&lt;BR /&gt;&lt;BR /&gt;   printf("%s",*pTime);&lt;BR /&gt;  return 0;;&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;It says " tm  undefined "&lt;BR /&gt;&lt;BR /&gt;         Can anyone help me in getting through this problem.&lt;BR /&gt;&lt;BR /&gt;thanks and regards&lt;BR /&gt;Vikram&lt;/TIME.H&gt;</description>
      <pubDate>Wed, 12 Dec 2007 06:50:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115258#M92801</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2007-12-12T06:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115259#M92802</link>
      <description>I did no programming for at least 10 years now, but I guess it must be something like&lt;BR /&gt;&lt;BR /&gt;struct tm *TimeNow;&lt;BR /&gt;time_t Now;&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Now = time ( NULL );&lt;BR /&gt;TimeNow = localtime ( &amp;amp;Now );&lt;BR /&gt;&lt;BR /&gt;printf ( "%s", ctime ( &amp;amp;Now ) );&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Dec 2007 07:20:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115259#M92802</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2007-12-12T07:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115260#M92803</link>
      <description>Yes it should be struct tm.&lt;BR /&gt;You have to define TimeNow as smthing.&lt;BR /&gt;There is nothin like tm.&lt;BR /&gt;&lt;BR /&gt;BR,&lt;BR /&gt;KApil</description>
      <pubDate>Wed, 12 Dec 2007 07:42:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115260#M92803</guid>
      <dc:creator>Kapil Jha</dc:creator>
      <dc:date>2007-12-12T07:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115261#M92804</link>
      <description>&lt;!--!*#--&gt;You can also do:&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;int main() {&lt;BR /&gt;   struct tm *TimeNow;&lt;BR /&gt;   time_t now = time(NULL);&lt;BR /&gt;   TimeNow = localtime(&amp;amp;now);&lt;BR /&gt;   printf("%s", asctime(TimeNow));&lt;BR /&gt;   return 0;&lt;BR /&gt;}&lt;/STDIO.H&gt;&lt;/TIME.H&gt;</description>
      <pubDate>Wed, 12 Dec 2007 08:22:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115261#M92804</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-12T08:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115262#M92805</link>
      <description>&amp;gt;KApil: There is nothin like tm.&lt;BR /&gt;&lt;BR /&gt;In a real language like C++ there is.  :-)&lt;BR /&gt;struct tm == tm</description>
      <pubDate>Wed, 12 Dec 2007 10:04:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115262#M92805</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-12T10:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115263#M92806</link>
      <description>&lt;!--!*#--&gt;Real language? &lt;BR /&gt;;-)&lt;BR /&gt;&lt;BR /&gt;Anyway, looks like "pure" C.&lt;BR /&gt;&lt;BR /&gt;Here is the struct&lt;BR /&gt;&lt;BR /&gt;struct tm {&lt;BR /&gt;           int tm_sec;  /* second (0-61, allows for leap seconds) */&lt;BR /&gt;           int tm_min;  /* minute (0-59) */&lt;BR /&gt;           int tm_hour; /* hour (0-23) */&lt;BR /&gt;           int tm_mday; /* day of the month (1-31) */&lt;BR /&gt;           int tm_mon;  /* month (0-11) */&lt;BR /&gt;           int tm_year; /* years since 1900 */&lt;BR /&gt;           int tm_wday; /* day of the week (0-6) */&lt;BR /&gt;           int tm_yday; /* day of the year (0-365) */&lt;BR /&gt;           int tm_isdst;/* non-0 if daylight savings time is in effect */&lt;BR /&gt;         };&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Dec 2007 10:12:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115263#M92806</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2007-12-12T10:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115264#M92807</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt; Yes, i missed struct there.&lt;BR /&gt;&lt;BR /&gt;  I am also able to achieve this by following 2 lines of code&lt;BR /&gt;&lt;BR /&gt;  #include &lt;TIME.H&gt;&lt;BR /&gt;  long t = time(0);&lt;BR /&gt;  cout &amp;lt;&amp;lt; asctime(localtime(&amp;amp;t))&amp;lt;&lt;ENDL&gt;&lt;/ENDL&gt;&lt;BR /&gt;thanks and regards&lt;BR /&gt;Vikram&lt;/TIME.H&gt;</description>
      <pubDate>Thu, 13 Dec 2007 08:57:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115264#M92807</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2007-12-13T08:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115265#M92808</link>
      <description>&lt;!--!*#--&gt;&amp;gt;I am also able to achieve this by following 2 lines of code&lt;BR /&gt;&lt;BR /&gt;If you are going to use iostream, you should go whole hog:  :-)&lt;BR /&gt;&lt;BR /&gt;#include &lt;CTIME&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;#include &lt;LOCALE&gt;&lt;BR /&gt;struct my_pt : public std::time_put&lt;CHAR&gt; {} tp;&lt;BR /&gt;struct my_ibase : public std::ios_base {};&lt;BR /&gt;int main() {&lt;BR /&gt;   std::tm *TimeNow;&lt;BR /&gt;   std::time_t now = std::time(NULL);&lt;BR /&gt;   TimeNow = std::localtime(&amp;amp;now);&lt;BR /&gt;   // printf("%s", asctime(TimeNow));&lt;BR /&gt;   const char format[] = "%a %b %d %H:%M:%S %Y\n";&lt;BR /&gt;   my_pt::iter_type o_itr(std::cout);&lt;BR /&gt;   my_ibase ibase;&lt;BR /&gt;   tp.put(o_itr, ibase, ' ', TimeNow, format, format + (sizeof(format)-1));&lt;BR /&gt;}&lt;/CHAR&gt;&lt;/LOCALE&gt;&lt;/IOSTREAM&gt;&lt;/CTIME&gt;</description>
      <pubDate>Thu, 13 Dec 2007 10:01:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115265#M92808</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-13T10:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting date and time from from time.h</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115266#M92809</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;  In my previous reply there is 1 wrong sorry for that  &lt;BR /&gt; it should be as below &lt;BR /&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;time_t t = time(0);&lt;BR /&gt;cout &amp;lt;&amp;lt; asctime(localtime(&amp;amp;t))&amp;lt;&lt;ENDL&gt;&lt;/ENDL&gt;&lt;BR /&gt;&lt;BR /&gt;thanks and regards&lt;BR /&gt;Vikram&lt;/TIME.H&gt;</description>
      <pubDate>Thu, 13 Dec 2007 13:02:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getting-date-and-time-from-from-time-h/m-p/4115266#M92809</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2007-12-13T13:02:53Z</dc:date>
    </item>
  </channel>
</rss>

