mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp
changeset 17 aabe5387f5ce
parent 0 d0791faffa3f
child 12 8b094906a049
equal deleted inserted replaced
0:d0791faffa3f 17:aabe5387f5ce
   873     TInt offset = User::UTCOffset().Int();
   873     TInt offset = User::UTCOffset().Int();
   874 	//get actul time to set, offset  + ,- or UTC and offset from UTC in seconds.
   874 	//get actul time to set, offset  + ,- or UTC and offset from UTC in seconds.
   875     TInt errorCode = ValidateString(aDateTime, dateTime, offset);
   875     TInt errorCode = ValidateString(aDateTime, dateTime, offset);
   876     if(KErrNone == errorCode)
   876     if(KErrNone == errorCode)
   877 	{
   877 	{
   878 	    StringToDateTime(dateTime);
   878 	    StringToDateTimeL(dateTime);
   879 	    iDateTime->SetL(dateTime);
   879 	    iDateTime->SetL(dateTime);
   880 	    StoreL();
   880 	    StoreL();
   881 	    //now set the system time by calling user SetUTCTime
   881 	    //now set the system time by calling user SetUTCTime
   882 	    TTime tt;
   882 	    TTime tt;
   883 	    errorCode = tt.Set(dateTime);
   883 	    errorCode = tt.Set(dateTime);
   921 /**
   921 /**
   922 *This method will convert MTP date time format ("YYYYMMDDThhmmss.s")to
   922 *This method will convert MTP date time format ("YYYYMMDDThhmmss.s")to
   923 *TTime time format YYYYMMDD:hhmmss.ssssss. Right now microsecond part is
   923 *TTime time format YYYYMMDD:hhmmss.ssssss. Right now microsecond part is
   924 * not implemented.
   924 * not implemented.
   925 **/
   925 **/
   926 void CMTPDeviceDataStore::StringToDateTime(TDes& aDateTime )
   926 void CMTPDeviceDataStore::StringToDateTimeL(TDes& aDateTime )
   927 	{
   927 	{
   928     __FLOG(_L8("StringToDateTime - Entry"));
   928     __FLOG(_L8("StringToDateTime - Entry"));
   929 	TBuf<30> newTime;
   929 	TBuf<30> newTime;
   930 	_LIT(KDlemMTP,"T");
   930 	_LIT(KDlemMTP,"T");
   931 	_LIT(KDlemTTime,":");
   931 	_LIT(KDlemTTime,":");
   954 		newTime.Append(aDateTime.Mid(pos + 1));
   954 		newTime.Append(aDateTime.Mid(pos + 1));
   955 		aDateTime.Copy(newTime);
   955 		aDateTime.Copy(newTime);
   956 		}
   956 		}
   957 	else
   957 	else
   958 		{
   958 		{
   959 		_LIT(KPanic, "date time ");
   959         User::Leave( KErrArgument );
   960 		User::Panic(KPanic, 3);
       
   961 		}
   960 		}
   962         __FLOG_1(_L("Processed DateTime: %S"), &aDateTime);	
   961         __FLOG_1(_L("Processed DateTime: %S"), &aDateTime);	
   963 	__FLOG(_L8("StringToDateTime - Exit"));
   962 	__FLOG(_L8("StringToDateTime - Exit"));
   964 	}
   963 	}
   965 
   964