Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 // This function is used to update month and day in aBufLocalTime
20 // to actual month and day to be passed to TTime() constructor.
21 // Remember using TTime::FormatL() in thelpers.cpp
22 // has added extra month and a day to aBufLocalTime.
23 // aBufLocalTime is in format YYMMDD:HHMMSS.MMMMMM
24 // see TTime::Set() for aBufLocalTime expected format details.
25 TInt UpdateToActualMonthAndDay(TDes& aBufUTCTime)
31 _LIT(KFormat, "%02d");
33 //Get the position of colon separator
34 TInt colon = aBufUTCTime.Locate(':');
36 // Get Month & Day if Present
42 TLex month = aBufUTCTime.Mid(4,2);
43 TLex day = aBufUTCTime.Mid(6,2);
50 // If the colon is at the wrong position
51 return (KErrArgument);
56 // Deduct extra month and a day and update aBufLocalTime
57 if(mVal > 0 && dVal > 0)
62 tempBuf.Format(KFormat, mVal);
63 aBufUTCTime.Replace(4,2, tempBuf);
65 tempBuf.Format(KFormat, dVal);
66 aBufUTCTime.Replace(6,2, tempBuf);
72 GLDEF_C TInt E32Main()
77 User::CommandLine(bufUTCTime);
78 err = UpdateToActualMonthAndDay(bufUTCTime);
82 TTime utcTime(bufUTCTime);
83 err = User::SetUTCTime(utcTime);