| | |
How to convert UNIX time stamp to syatem time stamp
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
Read http://en.wikipedia.org/wiki/Unix_time as a start.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
I have never seen before so funny "definitions" of a "unix timestamp" data type and a "system time" representation: 
Well, try to adopt this code:

•
•
•
•
unix time stamp is like = 1227806311
the same system time stamp is = 27/11/2008 HR MIN SEC
c Syntax (Toggle Plain Text)
/* UnixTime is unspecified unix time stamp type. * Define it before compilation, for example: * typedef time_t UnixTime; * or * typedef long int UnixTime; */ UnixTime ut; /* Unix timestamp to be converted */ time_t thist; /* This system timestamp value */ struct tm* ptm; char mysyst[20] = "\?"; /* for "sys time" */ const char* fmt = "%d/%m/%Y %H %M %S"; /* sys?time */ /* C Standard does not specify what's time_t epoch */ time_t uepoch; /* Unix epoch in this system time_t */ struct tm tmepoch; /* Prepare unix time epoch on this system */ memset(&tmepoch,0,sizeof tmepoch); tmepoch.tm_year = 1970 - 1900; tmepoch.tm_mon = 1 - 1; tmepoch.tm_mday = 1; tmepoch.tm_hour = 0; tmepoch.tm_min = 0; tmepoch.tm_sec = 0; uepoch = mktime(&tmepoch); /* this system unix epoch */ /* Recalculate unix time to this system time_t */ thist = (time_t)ut - uepoch; ptm = gmtime(&thist); if (ptm && strftime(mysyst,sizeof mysyst,fmt,ptm)) printf("%s\n",mysyst);
> Any one plz help me on this urgently?
You've had 13 days to play with the code ArkM posted, and now you're trying to make it into OUR problem?
http://www.catb.org/~esr/faqs/smart-...ns.html#urgent
Ha ha ha ha ha *plonk*
You've had 13 days to play with the code ArkM posted, and now you're trying to make it into OUR problem?
http://www.catb.org/~esr/faqs/smart-...ns.html#urgent
Ha ha ha ha ha *plonk*
> hmmmm dude i was busy with some other issues.
Your choice - give up programming or give up something else.
You're not going to learn anything by dipping into programming for a couple of hours a month, so I'd say give up.
Otherwise you would have found a way to do something in the last fortnight, rather than just showing up here at the last minute hoping for salvation.
Your choice - give up programming or give up something else.
You're not going to learn anything by dipping into programming for a couple of hours a month, so I'd say give up.
Otherwise you would have found a way to do something in the last fortnight, rather than just showing up here at the last minute hoping for salvation.
![]() |
Other Threads in the C++ Forum
- Previous Thread: simple command line argument program compiler errors
- Next Thread: linker error dev c++
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamic dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library linker list loop looping loops map math matrix memory microsoft newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






