I found this function which takes a Unix Epoch timestamp and returns a TTime
:
// This function converts a Unix Epoch timestamp to a TTime
TTime UnixToEpocTimeL(TUint32 aTimestamp)
{
// define the start of the Unix Epoch as beginning of Jan 1, 1970
_LIT(KUnixEpoch, "19700000:");
// Create a new time variable, and give it the starting value of Jan 1, 1970
TTime time;
User::LeaveIfError(time.Set(KUnixEpoch));
// The timestamp is the number of seconds since Jan 1, 1970
// Add the number of seconds in the timestamp to start date.
TTimeIntervalSeconds secs(aTimeStamp);
time += secs;
// the variable 'time' now contains the requested datetime
return time;
}
http://discussion.forum.nokia.com/forum/showthread.php?t=110494
UPDATE: I don't know much about this (nor do I have any way of testing it here!) but I have tried to add detailed comments explaining how I think it works. You can either add something similar to your code, or even add this a function and call it directly.