×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2007
    Location
    Finland
    Posts
    61

    CAknTimeOrDateSettingItem problem

    Hi,

    I'm using CAknTimeOrDateSettingItem on a SettingList. SettingList is constructed dynamically.

    Code:
    HBufC* endtimeText = StringLoader::LoadLC(R_SET_SCHEDULE_END_TIME_TEXT);
    		CAknTimeOrDateSettingItem* item3 = new (ELeave) CAknTimeOrDateSettingItem(3,CAknTimeOrDateSettingItem::ETime,iEndTime);
    		CleanupStack::PushL(item3);
    		item3->ConstructL(isNumberedStyle,3,*endtimeText,icons,R_TIME_SETTING_PAGE,-1);
    		iItemList->SettingItemArray()->AppendL(item3);
    		CleanupStack::Pop(item3);
    		CleanupStack::PopAndDestroy(endtimeText);
    Time seems to be ok after setting desired time, but when I compare this time for example to current time(TTime::HomeTime) using > operator, the result is not what it should be. When I set time from settings for example to 15:00 and homeTime is 14:00 application says hometime is later than this other time, which is not the case.

    What could be the problem?

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: CAknTimeOrDateSettingItem problem

    It might happen to be some time-zone issue. Starting from S60 3rd edition (or Symbian 9.x, I do not know really) the platform has started to love universal time.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Location
    Finland
    Posts
    61

    Re: CAknTimeOrDateSettingItem problem

    I managed to solve this problem by first converting TTime object to TDateTime. Then read hours and minutes from it(TDateTime::Hour & TDateTime::Minute). After that I created TTime object and initialized it using TTime::HomeTime. Then converted this object also to TDateTime and then set hours and minutes read previously from TDateTime to this object and finally converted it back to TTime.

    On debugging I noticed that TTime objects TInt64 iTime data member value where shorter when setting TTime from settings list than using method described above.

    Is there maybe simplier way to do this? :)

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: CAknTimeOrDateSettingItem problem

    I am not sure. If it really was a timezone issue, search for "universal time" in the SDK Help, and there will be a hit called "How to implement universal time and home time", showing an apparently simpler solution.

  5. #5
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: CAknTimeOrDateSettingItem problem

    My guess is that CAknTimeOrDateSettingItem stored only time in your iEndTime but not the date, while TTime::HomeTime() sets the date and time.

    So you were comparing something like "15:00 Jan 1, 0000" to "14:00 Jun 19, 2008". If this is the case then the comparison is correct - the current TTime is much later than the one you got from the CAknTimeOrDateSettingItem.
    Regards,
    ivey

  6. #6
    Registered User
    Join Date
    Nov 2007
    Location
    Finland
    Posts
    61

    Re: CAknTimeOrDateSettingItem problem

    Quote Originally Posted by ivey View Post
    My guess is that CAknTimeOrDateSettingItem stored only time in your iEndTime but not the date, while TTime::HomeTime() sets the date and time.

    So you were comparing something like "15:00 Jan 1, 0000" to "14:00 Jun 19, 2008". If this is the case then the comparison is correct - the current TTime is much later than the one you got from the CAknTimeOrDateSettingItem.
    I checked that date was correct by using TTime::FormatL. So I think this is not the problem.

    I will check that 'How to implement universal time and home time' from SDK help.

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

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