×

Discussion Board

Results 1 to 4 of 4

Hybrid View

  1. #1
    Super Contributor
    Join Date
    Nov 2008
    Posts
    675

    Comparison of TTime item in Setting list and current time fails

    Hi,
    I have created a Setting List in my application following the link
    http://wiki.forum.nokia.com/index.php/Settings_Lists

    I have a Time editor in the Setting List.

    Once the time is set in the setting list,my app performs a comparison between the set time and current time.
    Say the time set was 3.52 PM
    The comparison is done as follows:-
    Code:
     TTime now;
    	 TTime settingTime;
    	 settingTime = iSleepSettingsData->SettingTime();
    	 now.HomeTime();
    	 HBufC* timeFormatString = NULL;
    	 TBuf<50> timeString;
    	 timeFormatString = CEikonEnv::Static()->
    	                AllocReadResourceLC(R_QTN_TIME_USUAL);
    	 
    	 now.FormatL(timeString,*timeFormatString);
    	 RDebug::Printf("Present time:");
    	 RDebug::Print(timeString);
    	 
    	 settingTime.FormatL(timeString,*timeFormatString);
    	 RDebug::Printf("Setting time:");
    	 RDebug::Print(timeString);
    	 TTimeIntervalHours minDiff;
    	 now.HoursFrom(settingTime, minDiff);
    	 RDebug::Print(_L("Current time is %d hours ahead from set time ////////////////////////////"),minDiff.Int());
    	 if(now.operator ==(settingTime)){
    
               RDebug::Printf("The comparison succeeded");
             }else{
               RDebug::Printf("The comparison failed");
             }
    The output is as follows:-

    Present time:
    5:57 pm
    Setting time:
    3:52 pm
    Current time is 17619842 hours ahead from set time ////////////////////////////
    The comparison failed

    Kindly someone please tell me why it gives such an absurd number of hours when the difference is just 2.
    Should i convert the TTime received from the setting list to some other format.What is being done wrong...
    Plz Help!!!

    Regards
    Biju Chandran

  2. #2
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: Comparison of TTime item in Setting list and current time fails

    Have you tested it on real device. It should work fine on the device.

  3. #3
    Super Contributor
    Join Date
    Nov 2008
    Posts
    675

    Re: Comparison of TTime item in Setting list and current time fails

    No it doesnt work on the real device as well..
    When a supply the settingTime to an RTimer this way
    Code:
    iTimer->At(settingTime));
    Then the callback method of the notifier of the timer AO,registers an error with error code -10.
    Code:
    void CAppUi::TimerExpired(TAny* aTimer,TInt aError)
    	{
    	if(aError == KErrNone)
    	  {
    	  // Timer successfully completed, handle it
    	  ShowInfoL(_L("Timer Expired"));
    	  }
    	}
    aError is -10.

    Error code -10 is
    In the context of mathematical or time/date functions, indicates a calculation that has produced a result smaller than the smallest magnitude of a finite number allowed by the representation.

    When i print the settingTime as explained in the previous post it prints it proper.
    What is it that i should do to give the setting time as input to the RTimer.Is any intermediate conversion needed????

  4. #4
    Super Contributor
    Join Date
    Nov 2008
    Posts
    675

    Re: Comparison of TTime item in Setting list and current time fails

    Has no one experienced this before.
    Champions please share your experience.....

Similar Threads

  1. Error in packaging process :(
    By a-eqla3 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2008-07-24, 20:33
  2. How to activate another view on selection of Setting List item
    By rahulm in forum Symbian User Interface
    Replies: 2
    Last Post: 2007-09-03, 01:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×