HI All,
Ant Unix method or C++ method is there to convert unix time stamp to system time stamp.The input is ULONG and out put should be in string.
u can intimate to <email snipped>
Any help is appreciated in advance.
HI All,
Ant Unix method or C++ method is there to convert unix time stamp to system time stamp.The input is ULONG and out put should be in string.
u can intimate to <email snipped>
Any help is appreciated in advance.
Can you explain what is meant by "unix timestamp" and (mainly) "system timestamp"?
Can you explain what is meant by "unix timestamp" and (mainly) "system timestamp"?
unix time stamp is like = 1227806311
the same system time stamp is = 27/11/2008 HR MIN SEC
I have never seen before so funny "definitions" of a "unix timestamp" data type and a "system time" representation: ;)
unix time stamp is like = 1227806311
the same system time stamp is = 27/11/2008 HR MIN SEC
Well, try to adopt this code:
/* 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);
Sry to tell you guys my output time should be GMT or UTC.Any one plz help me on this urgently?
> 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-questions.html#urgent
Ha ha ha ha ha *plonk*
hmmmm dude i was busy with some other issues.
hmmmm dude i was busy with some other issues.
Just the TIME to go on with that issues ;)...
> 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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.