NlMakesis Y-Browser Y-Tasks
---------------Bhatt Kavita
"beer is proof that god loves us, and wants us to be happy!"
"I only know that I know nothing." (Socrates)
Forum posts: 75
LPTSTR GetCurrentTimeStr()
{
char buff[512];
LPTSTR szTime = NULL;
time_t result;
PTIME loctime;
result = time(NULL);
loctime = localtime(&result);
sprintf(buff, "%s-%s-%s %s:%s:%s", CheckForDigit((loctime->tm_year)+1900), CheckForDigit(loctime->tm_mon+1), CheckForDigit(loctime->tm_mday), CheckForDigit(loctime->tm_hour), CheckForDigit(loctime->tm_min), CheckForDigit(loctime->tm_sec));
szTime = (LPTSTR) malloc((strlen(buff)+1)*sizeof(WCHAR));
mbstowcs(szTime, buff, strlen(buff));
szTime[strlen(buff)] = 0;
return szTime;
}
char *CheckForDigit(int iTime)
{
char buff[10];
char *szRet;
if (iTime < 10)
sprintf(buff, "0%i", iTime);
else
sprintf(buff, "%i", iTime);
szRet = new char[strlen(buff)+1];
strcpy(szRet, buff);
szRet[strlen(buff)] = 0;
return szRet;
}
include time.h and link against estlib.lib
hope this helps (sorry cant explain a bit more!)
R
"beer is proof that god loves us, and wants us to be happy!"
Forum posts: 672
How can I retreive handset time using systemfiles.
Any idea or some help.
Thanks
TTime now;
now.HomeTime();
Forum posts: 214
now.HomeTime();
TBuf<25> timeAsText;
_LIT(KDateString," %D%M%Y%/0%1%/1%2%/2%3%/3 %H:%T");
now.FormatL(timeAsText,KDateString);
"I only know that I know nothing." (Socrates)