void CBadRRule::CreateChild2L()
{
	TInt num ;
	
	TCalTime rec2 ;
	rec2.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 16, 10, 1, 0, 0))) ; //Jan 17

	HBufC8* guid_c2 = KGUID().AllocLC(); // ownership of guid1 gets transferred
	CCalEntry *entry_c2 = CCalEntry::NewL(CCalEntry::EEvent, guid_c2, CCalEntry::EMethodNone, 0, rec2, CalCommon::EThisAndAll);
	CleanupStack::Pop(guid_c2);
	CleanupStack::PushL(entry_c2) ;	

	TCalTime startTime_c2 ;
	TCalTime endTime_c2 ;	
	startTime_c2.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 8, 11, 2, 0, 0))) ;
	endTime_c2.SetTimeUtcL(startTime_c2.TimeUtcL() + TTimeIntervalHours(1)) ;
	entry_c2->SetStartAndEndTimeL(startTime_c2, endTime_c2) ;
	
	RPointerArray<CCalEntry> entryarr_c2 ;	
	entryarr_c2.AppendL(entry_c2) ;
	iCalEntryView->StoreL(entryarr_c2, num) ;		
	entryarr_c2.Close() ;
	
	CleanupStack::PopAndDestroy(entry_c2) ;
	
}
示例#2
0
//============================================================
//---------------------------------------------------------------------------
/*static*/TDateTime dtg::getUTC(  double correction )
{
   // TDateTime(0) is 12/30/1899
   SYSTEMTIME syst;
   GetSystemTime( &syst );

   // we need it as a FILETIME so we can do calculations...
   // FILETIME is 100-nanosecond intervals since January 1, 1601.
   FILETIME SysFileTime;  // 100 nanosec resolution
   SystemTimeToFileTime( &syst, &SysFileTime );

   ULARGE_INTEGER utc;
   utc.LowPart = SysFileTime.dwLowDateTime;
   utc.HighPart = SysFileTime.dwHighDateTime;

   __int64 lgTemp = utc.QuadPart;
   __int64 SecsTo1970 = 116444736000000000LL; // actually 100 ns units - from MSDN
   lgTemp -= SecsTo1970;

   lgTemp /= 10000;  //now millisecs
   lgTemp /= 1000;  //now secs

   double t;
   t = lgTemp;

   TDateTime tdt( t / daySecs );
   tdt += TDateTime( 1970, 1, 1 );
   if ( correction )
      tdt += TDateTime( correction );
   return tdt;
}
void CBadRRule::CreateChild1L()
{
	TInt num ;
	
	TCalTime recId;

	recId.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 9, 10, 1, 0, 0))); // creating recurrence id

	HBufC8* guid1 = KGUID().AllocLC(); // ownership of guid1 gets transferred
	CCalEntry *entry1 = CCalEntry::NewL(CCalEntry::EEvent, guid1, CCalEntry::EMethodNone, 0, recId, CalCommon::EThisOnly);
	CleanupStack::Pop(guid1);			
	CleanupStack::PushL(entry1) ;	

	TCalTime startTime3 ;
	TCalTime endTime3 ;	
	startTime3.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 7, 10, 2, 0, 0))) ;
	endTime3.SetTimeUtcL(startTime3.TimeUtcL() + TTimeIntervalHours(1)) ;
	entry1->SetStartAndEndTimeL(startTime3, endTime3) ;
	
	RPointerArray<CCalEntry> entryarr1 ;	
	entryarr1.AppendL(entry1) ;
	iCalEntryView->StoreL(entryarr1, num) ;		
	entryarr1.Close() ;	
	
	CleanupStack::PopAndDestroy(entry1) ;

}
void CDummyCalendarApp::RepeatExceptedEntryEditInstancesL(
    RPointerArray<CCalInstance>& aInstances )
	{
	CleanupResetAndDestroyPushL(aInstances);	
	
	// Delete all entries.
	iEntries.ResetAndDestroy();
	
	TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0));
	TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0));	
	
	// Re-create all the entries that previously existed.
	CCalEntry* entry = NULL;
	for (TUint i = 0; i < aInstances.Count(); ++i)
		{
		HBufC8* guid = KGUIDInc081869().AllocLC();	
		entry = CCalEntry::NewL( CCalEntry::EAppt, guid, CCalEntry::EMethodAdd,
		    i, aInstances[i]->Time(), CalCommon::EThisOnly );
		CleanupStack::Pop( guid );
		iEntries.AppendL( entry );
		
		SetEntryStartAndEndTimeL(entry, start, end);		
		}
	
	CleanupStack::PopAndDestroy(&aInstances);
	
	// Store the entries again, there should be 2.
	TInt entriesStored = 0;
	SynCGetEntryViewL().StoreL(iEntries, entriesStored);
	test(entriesStored == iEntries.Count());
	}
void CDummyCalendarApp::RepeatExceptedEntryCreateL()
	{
	test.Next(_L("Add entry, repeat twice, set excepted and delete"));

	iEntries.ResetAndDestroy();	
	
	// Create new calendar entry.
	CCalEntry* entry = NULL;
	HBufC8* guid = KGUIDInc081869().AllocLC();	
	entry = CreateCalEntryL(CCalEntry::EAppt, guid);
	CleanupStack::Pop(guid);
	
	iEntries.AppendL(entry);	

    // Set start and end date.
	TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0));
	TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0));
	SetEntryStartAndEndTimeL(entry, start, end);
	
	TBuf<50> summary;			
	RandomText(summary);
	entry->SetSummaryL(summary);

	TBuf<50> location;
	RandomText(location);
	entry->SetLocationL(location);

	TBuf<50> description;		
	RandomText(description);
	entry->SetDescriptionL(description);	

	// Create a daily repeating rule that occurs for 2 days.
	TCalRRule rpt(TCalRRule::EDaily);
	rpt.SetInterval(1);
	rpt.SetCount(2);	
	
	// Make sure the repeat time is within the delete time range.
	TCalTime repeatStart;
	TCalTime repeatEnd;
	repeatStart.SetTimeLocalL(TDateTime(2006, EMarch, 6, 0, 0, 0, 0));
	repeatEnd.SetTimeLocalL(TDateTime(2006, EMarch, 8, 0, 0, 0, 0));
	rpt.SetDtStart(repeatStart); 
	rpt.SetUntil(repeatEnd);
	entry->SetRRuleL(rpt);

    // Store the entry. Because it repeats over 2 days, there will
    // be 2 entries.
	TInt entriesStored(0);
	SynCGetEntryViewL().StoreL(iEntries, entriesStored);
	test(entriesStored == iEntries.Count());
	}
/**
 *	Second phase for initializing settings data
 */
void TCalendarManagerSettingItemListSettings::ConstructL()
	{
	// [[[ begin generated region: do not modify [Generated Initializers]
	SetSchedule_Date( TTime( TDateTime( 2000, EJanuary, 0, 0, 0, 0, 0 ) ) );
	SetSchedule_Time( TTime( TDateTime( 0, EJanuary, 0, 0, 0, 0, 0 ) ) );
		{
		HBufC* text = StringLoader::LoadLC( R_CALENDAR_MANAGER_SETTING_ITEM_LIST_SCHEDULE_CONTENT );
		SetSchedule_Content( text->Des() );
		CleanupStack::PopAndDestroy( text );
		}
	SetSchedule_Reminder( 0 );
	// ]]] end generated region [Generated Initializers]
	
	}
void CDummyCalendarApp::DeleteAllMemosBeginL()
	{
	test.Printf(_L("Test: DeleteAllMemosBeginL\r\n"));
	//Add 1000 entries
	test.Printf(_L("Adding 1000 Memos...\r\n"));
	
	const TInt KNumEntriesToAdd(1000);
	
	iTestLib->OpenFileL(KCalendarFile);
	
	for (TInt i(0) ; i < KNumEntriesToAdd ; ++i)
		{
		HBufC8* guid = NULL;
		CCalEntry* entry = iTestLib->CreateCalEntryL(CCalEntry::EReminder, guid);
		CleanupStack::PushL(entry);
		
		SetEntryStartAndEndTimeL(entry,
									TDateTime(2005, ESeptember, 12, 0, 0, 0, 0),
									TDateTime(2005, ESeptember, 12, 1, 0, 0, 0));
		
		RPointerArray<CCalEntry> entryArray;
		CleanupClosePushL(entryArray);
		
		entryArray.AppendL(entry);
		TInt num;
		iTestLib->SynCGetEntryViewL().StoreL(entryArray, num);
		
		CleanupStack::PopAndDestroy(&entryArray);
		CleanupStack::PopAndDestroy(entry);
		
		test.Printf(_L("."));
		}
		
	TCalTime minTime;
	minTime.SetTimeUtcL(TCalTime::MinTime());
	TCalTime maxTime;
	maxTime.SetTimeUtcL(TCalTime::MaxTime());
	CalCommon::TCalTimeRange timeRange(minTime, maxTime);
	
	iActive->SetStep(CAppActive::EDeleteAllMemosMiddle);
	
	//Attempt to delete all the entries
	test.Printf(_L("Deleting all the entries...\r\n"));
	iTestLib->SynCGetEntryViewL().DeleteL(timeRange, CCalEntry::EReminder, *this);
	CActiveScheduler::Start();
	delete iTestLib;
	iTestLib = NULL;
	}
示例#8
0
void CHttpHdrTest::TestAddSinglePartQuickL()
	{
	RStringF accStr = iStrP.StringF(HTTP::EAccept,RHTTPSession::GetTable());
	RStringF textHtmlStr = iStrP.StringF(HTTP::ETextHtml,RHTTPSession::GetTable());
	RStringF expiresStr = iStrP.StringF(HTTP::EExpires,RHTTPSession::GetTable());
	RStringF maxForwardsStr = iStrP.StringF(HTTP::EMaxForwards,RHTTPSession::GetTable());

	//
	//    Accept: text/html
	//
	// creates a single stringtoken part 
	CHeaderField* accept = CHeaderField::NewL(accStr, *iHdrColl, THTTPHdrVal(textHtmlStr));
	CleanupStack::PushL(accept);
	//
	//	  Expires: Mon, 15 Jan 2001 10:30:25 GMT
	//
	// creates a single date/time part, using an implicit case
	CHeaderField* expires = CHeaderField::NewL(expiresStr, *iHdrColl, TDateTime(2001, EJanuary, 15, 10, 30, 25, 0));
	CleanupStack::PushL(expires);
	//
	//	  Max-Forwards: 3
	//
	// creates a single integer part, using an implicit case
	CHeaderField* maxfwds = CHeaderField::NewL(maxForwardsStr, *iHdrColl, 3);
	CleanupStack::PushL(maxfwds);

	// Now just destroy that lot
	CleanupStack::PopAndDestroy(3);
	}
示例#9
0
LOCAL_C void AddFindRecordsL(CContactDatabase* aDb)
	{
	CContactItem* systemTemplate=ReadContactIncHiddenFieldsLC(aDb,aDb->TemplateId());
	for (TInt ii=0;ii<KTotalFindRecords;ii++)
		{
		CContactItem* item=CContactCard::NewLC(systemTemplate);
		TBuf<16> name;
		if (ii%2)
			{
			name.Format(_L("Bates %d"),ii);
			SetNameL(*item,KUidContactFieldJobTitle,name,EFalse);
   			//SetNameL(*item,KUidContactFieldFamilyName,name,EFalse);
   			SetNameL(*item,KUidContactFieldGivenName,_L("Norman"),EFalse);
			}
		else
			{
			name.Format(_L("Sod %d"),ii);
   			SetNameL(*item,KUidContactFieldFamilyName,name,EFalse);
   			SetNameL(*item,KUidContactFieldGivenName,_L("Silly"),EFalse);
			}
		if (ii%3)
			{
			CContactItemField* field=CContactItemField::NewLC(KStorageTypeDateTime,KUidContactFieldBirthday);
			field->DateTimeStorage()->SetTime(TDateTime(1990+ii,(TMonth)(ii%12),(ii*3)%28,1,2,3,4));
			item->AddFieldL(*field);
			CleanupStack::Pop(); // field
			}
		aDb->AddNewContactL(*item);
		CleanupStack::PopAndDestroy(); // item
		}
	CleanupStack::PopAndDestroy(); // systemTemplate
	}
示例#10
0
TDateTime toDateTime( const std::string& s, const TDateTime& defaultVal )
{
    char yearMonth, monthDay, dayHour, hourMin, minSec, secMsec;
    unsigned short year, month, day, hour, min, sec, msec;
    year = month = day = hour = min = sec = msec = 0;

    std::istringstream in(s);

    in >> year >> yearMonth >> month >> monthDay >> day
        >> dayHour >> hour >> hourMin >> min >> minSec
        >> sec >> secMsec >> msec;

    TDateTime t = defaultVal;

    if ( 
        ( year   > 1899 ) &&
        ( year   < 9999 ) &&
        ( month  < 13 )   &&
        ( month  > 0  )   &&
        ( day    < 32 )   &&
        ( day    > 0 )    &&
        ( hour   < 24 )   &&
        ( min    < 60 )   &&
        ( minSec < 60 )   &&
        ( msec   < 1000 ) )
    {
        t = TDateTime(year, month, day, hour, min, sec, msec);
    }

    return t;
}
示例#11
0
void CReferenceHandler::CreateReferenceObject2L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport)
{
    //Reset the object (also resets the buffer)
    aObject.Reset();
    const TUint KNumOfObjects = 2;
    aObjectBuf.ResizeL(KNumOfObjects * 20);
    //populate the buffer...
    _LIT8(KRefDesc2, "*Reference Object 2*");
    TUint i;
    for (i=0; i<KNumOfObjects; i++)
    {
        aObjectBuf.Write(20*i, KRefDesc2);
    }
    //populate the object
    aObject.SetNameL(KRef2Name);
    aObject.SetTypeL(KRefType);
    aObject.SetLengthL(aObjectBuf.Size());
    const TTime KRef2Time = TDateTime(2002, EJanuary, 0, 0, 0, 0, 0);
    aObject.SetTimeL(KRef2Time);

    // Set up the MF description header
    const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters
    HBufC* descBuf = HBufC::NewLC(KDescLength);
    ASSERT(descBuf);
    TPtr ptr(descBuf->Des());
    ptr.Zero();
    for (i=0; i<KDescLength; i++)
    {
        ptr.AppendNumFixedWidth(i%10, EDecimal, 1);
    }
    aObject.SetDescriptionL(ptr);
    CleanupStack::PopAndDestroy(descBuf);
    aObject.SetTargetL(KRefIrMCTarget);
    aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrLength  | KObexHdrTime | KObexHdrDescription | KObexHdrTarget);
}
示例#12
0
LOCAL_C void SetKnownDateAndTime()
	{
	TDateTime aDateTimes[]={
				TDateTime(2002,EJune,18,10,30,0,0),
				TDateTime(2003,EJanuary,1,21,0,0,0),
				TDateTime(2001,EDecember,18,2,15,0,0),
				TDateTime(2004,EMay,18,17,50,0,0)
				};
	if (!StartTimeSet)
		{
		StartTime.UniversalTime();
		StartTimeSet=ETrue;
		}
	TTime aFakeTime(aDateTimes[KnownDateTimeIndex++]);
	KnownDateTimeIndex&=3;
	User::SetHomeTime(aFakeTime);
	}
示例#13
0
CTzRules* CTzUserDataTest::CreateUserDefinedTzLC(TInt16 aStandardOffset,TInt16 aDSTOffset)
	{
	TTime dston (TDateTime(2005, EMarch, 0, 0, 0, 0, 0)); 
	TTime dstoff (TDateTime(2005, ESeptember, 0, 0, 0, 0, 0));
	TMonth monthOn = dston.DateTime().Month();
	TInt dayOn = dston.DateTime().Day();
	TMonth monthOff = dstoff.DateTime().Month();
	TInt dayOff = dstoff.DateTime().Day();

	TTzRule dstOff(0, 9999, aStandardOffset, aDSTOffset, monthOn,  ETzFixedDate, dayOn,  0, ETzWallTimeReference, 120);
	TTzRule dstOn (0, 9999, aDSTOffset, aStandardOffset, monthOff, ETzFixedDate, dayOff, 0, ETzWallTimeReference, 120);

	CTzRules* rules = CTzRules::NewL(0, 9999);
	CleanupStack::PushL(rules);
	rules->AddRuleL(dstOff);
	rules->AddRuleL(dstOn);
	return rules;
	}
TDateTime TDateTime::CurrentDate()
{

	time_t ti;
	struct tm *ptm;
	time(&ti);
	ptm=localtime(&ti);
	return TDateTime(ptm->tm_year+EPOCH_YEAR,ptm->tm_mon+1,ptm->tm_mday);
}
示例#15
0
void CReferenceHandler::CreateReferenceObject7L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport)
{
    //Reset the object (also resets the buffer)
    aObject.Reset();
    const TUint KNumOfAlphabets = 200;
    aObjectBuf.ResizeL(KNumOfAlphabets * 30);
    //populate the buffer...
    TBuf8<4> buf;
    TUint i;
    for (i=0; i<KNumOfAlphabets; i++)
    {
        buf.Zero();
        buf.AppendNumFixedWidth(i, EDecimal, 4);
        aObjectBuf.Write(30*i, buf);
        aObjectBuf.Write(30*i + 4, KAlphabet);
    }
    //populate the object

    aObject.SetNameL(KRef7Name);
    aObject.SetTypeL(KRefImageJpegType);
    aObject.SetLengthL(aObjectBuf.Size());
    const TTime KRef5Time = TDateTime(2001, EFebruary, 14, 15, 38, 24, 0);//set time to 15:38:24.0 on 14th Feb 2001 - obex doesn't transfer microseconds!!
    aObject.SetTimeL(KRef5Time);

    _LIT8(KRef1HTTP, "Accept: text/*");
    _LIT8(KRef2HTTP, "Location: http://www.w3.org");
    _LIT8(KRef3HTTP, "Date: Tue, 10 Nov 2002 09:17:21 GMT");

    aObject.AddHttpL(KRef1HTTP);
    aObject.AddHttpL(KRef2HTTP);
    aObject.AddHttpL(KRef3HTTP);
    aObject.AddHttpL(KRef1HTTP);
    aObject.AddHttpL(KRef2HTTP);
    aObject.AddHttpL(KRef3HTTP);
    aObject.AddHttpL(KRef1HTTP);
    aObject.AddHttpL(KRef2HTTP);
    aObject.AddHttpL(KRef3HTTP);


    // Set up the MF description header
    const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters
    HBufC* descBuf = HBufC::NewLC(KDescLength);
    /*	ASSERT(descBuf);
    	TPtr ptr(descBuf->Des());
    	ptr.Zero();
    	for (i=0; i<KDescLength; i++)
    		{
    		ptr.AppendNumFixedWidth(i%10, EDecimal, 1);
    		}
    	aObject.SetDescriptionL(ptr);
    */
    CleanupStack::PopAndDestroy(descBuf);

    aObject.SetTargetL(KRefSyncMLTarget);
    aObject.SetHeaderMask(KObexHdrName | KObexHdrType  | KObexHdrTime | KObexHdrLength | KObexHdrHttp | KObexHdrTarget);
}
void CBadRRule::CheckInstancesL(RArray<TTime> &insTimes)
{
	RPointerArray<CCalInstance> instanceArray ;

	TCalTime startTime ;
	TCalTime endTime ;	
	startTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 1, 10, 1, 0, 0))) ;
	endTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 30, 10, 5, 0, 0))) ;		
	
	CalCommon::TCalTimeRange timeRange(startTime, endTime);
	
	CCalInstanceView &insView = iTestLib->SynCGetInstanceViewL();	
	
	insView.FindInstanceL(instanceArray, CalCommon::EIncludeAll, timeRange);		
	
	TInt count = instanceArray.Count() ;
	TInt count1 = insTimes.Count() ;
	
	test(count == count1) ;
	TInt i, j ;
	
	for(i = 0; i < count1; i++)
		{
		for(j = 0; j < count; j++)
			{
			if (instanceArray[j] == NULL)
				{
				continue ;
				}
			TTime t1 = instanceArray[j]->Time().TimeUtcL() ;		
			TDateTime d1 = t1.DateTime() ;	
			if (insTimes[i] == t1)
				{
				delete instanceArray[j] ;
				instanceArray[j] = NULL ;
				break ;
				}			
			}
			test(j < count) ;		
		}
	
	instanceArray.Close() ;		
}
示例#17
0
//---------------------------------------------------------------------------
void __fastcall TGUIConfiguration::Default()
{
  TConfiguration::Default();

  // reset before call to DefaultLocalized()
  FDefaultCopyParam.Default();

  FCopyParamListDefaults = true;
  DefaultLocalized();

  FIgnoreCancelBeforeFinish = TDateTime(0, 0, 3, 0);
  FContinueOnError = false;
  FConfirmCommandSession = true;
  FSynchronizeParams = TTerminal::spNoConfirmation | TTerminal::spPreviewChanges;
  FSynchronizeModeAuto = -1;
  FSynchronizeMode = TTerminal::smRemote;
  FMaxWatchDirectories = 500;
  FSynchronizeOptions = soRecurse | soSynchronizeAsk;
  FQueueTransfersLimit = 2;
  FQueueKeepDoneItems = true;
  FQueueKeepDoneItemsFor = 15;
  FQueueAutoPopup = true;
  FSessionRememberPassword = false;
  UnicodeString ProgramsFolder;
  SpecialFolderLocation(CSIDL_PROGRAM_FILES, ProgramsFolder);
  FDefaultPuttyPathOnly = IncludeTrailingBackslash(ProgramsFolder) + L"PuTTY\\" + OriginalPuttyExecutable;
  FDefaultPuttyPath = L"%PROGRAMFILES%\\PuTTY\\" + OriginalPuttyExecutable;
  FPuttyPath = FormatCommand(FDefaultPuttyPath, L"");
  PSftpPath = FormatCommand(L"%PROGRAMFILES%\\PuTTY\\psftp.exe", L"");
  FPuttyPassword = false;
  FTelnetForFtpInPutty = true;
  FPuttySession = L"WinSCP temporary session";
  FBeepOnFinish = false;
  FBeepOnFinishAfter = TDateTime(0, 0, 30, 0);
  FCopyParamCurrent = L"";
  FKeepUpToDateChangeDelay = 500;
  FChecksumAlg = L"md5";
  FSessionReopenAutoIdle = 9000;

  FNewDirectoryProperties.Default();
  FNewDirectoryProperties.Rights = TRights::rfDefault | TRights::rfExec;
}
示例#18
0
//=============================================================================
TDateTime CanonicalToTDT( String cdtg )
{
   TDateTime d;
   try
   {
      String year = cdtg.SubString( 1, 4 );
      String month = cdtg.SubString( 5, 2 );
      String day = cdtg.SubString( 7, 2 );
      String hour = cdtg.SubString( 9, 2 );
      String min = cdtg.SubString( 11, 2 );

      d = TDateTime( year.ToIntDef( 0 ), month.ToIntDef( 0 ), day.ToIntDef( 0 ) );
      d += TDateTime( hour.ToIntDef( 0 ), min.ToIntDef( 0 ), 0, 0 );
   }
   catch ( EConvertError & e )
   {
      return TDateTime();
   }
   return d;

}
示例#19
0
//---------------------------------------------------------------------------
TDateTime __fastcall TFileOperationProgressType::TimeExpected()
{
  unsigned int CurCps = CPS();
  if (CurCps)
  {
    return TDateTime((double)(((double)(TransferSize - TransferedSize)) / CurCps) / SecsPerDay);
  }
  else
  {
    return 0;
  }
}
示例#20
0
TDateTime localToUTC( TDateTime t )
{
   /*
      void __fastcall DecodeDate(unsigned short* year, unsigned short*
           month, unsigned short* day) const;
      void __fastcall DecodeTime(unsigned short* hour, unsigned short*
           min, unsigned short* sec, unsigned short* msec) const;

   */
   unsigned short year;
   unsigned short month;
   unsigned short day;
   unsigned short hour;
   unsigned short min;
   unsigned short sec;
   unsigned short msec;

   t.DecodeDate( &year, &month, &day );
   t.DecodeTime( &hour, &min, &sec, &msec );

   bool isDst = false;

   unsigned int yoffset = year - 2006;          // base year for DST figures

   if ( year < 2006 || yoffset >= sizeof( DSTStart ) / sizeof( int ) )
   {
      static dstShown = 0;
      if (dstShown != calendarYear)
         ShowMessage( "DST conversions only defined from 2006 until 2011!" );
      dstShown = calendarYear;
      return t;
   }
   if ( month > 3 && month < 10 )
   {
      isDst = true;
   }
   else
      if ( month == 3 && day >= DSTStart[ yoffset ] )
      {
         isDst = true;
      }
      else
         if ( month == 10 && day < DSTEnd[ yoffset ] )
         {
            isDst = true;
         }
   if ( isDst )
   {
      t -= TDateTime( 1, 0, 0, 0 );
   }
   return t;
}
void CBadRRule::TestBadRRuleL()
{

	test.Printf(_L("TestBadRRule start\n"));

	CCalEntryView& view = iTestLib->SynCGetEntryViewL() ;
	iCalEntryView = &view ;

	
	CreateParentL() ;
	
		
	CreateChild2L() ;   // Create child entry with exception

	CreateChild1L() ;   // Creating a another child 	
	
	
	RArray<TTime> insTimes ;

	insTimes.Append(TTime(TDateTime(2006, EJanuary, 7, 10, 2, 0, 0))) ;
	insTimes.Append(TTime(TDateTime(2006, EJanuary, 8, 11, 2, 0, 0))) ;
	insTimes.Append(TTime(TDateTime(2006, EJanuary, 23, 10, 1, 0, 0))) ;
	
	CleanupClosePushL(insTimes) ;	
	CheckInstancesL(insTimes) ;
	CleanupStack::PopAndDestroy(&insTimes) ;
	
	ModifyEntriesL() ;	// now modifying the parent again 			
	
	DeleteEntriesL() ;		// now try deleting entry 		

	CreateToDoEntryL() ;
	
	
	/* if executed to this point test has actully passed */
	
	test.Printf(_L("TestBadRRule successful\n"));
}
示例#22
0
//---------------------------------------------------------------------------
void TClockDlg::setEdits()
{
   initialised = false;
   TDateTime corr = dtg::getUTC( correction );
   DayEdit->Text = corr.FormatString( "dd" );
   MonthEdit->Text = corr.FormatString( "mm" );
   YearEdit->Text = corr.FormatString( "yyyy" );

   TDateTime dtt = TDateTime( correction );
   HoursEdit->Text = dtt.FormatString( "h" );
   MinutesEdit->Text = dtt.FormatString( "n" );
   SecondsEdit->Text = dtt.FormatString( "s" );
   initialised = true;
}
示例#23
0
void TMain::UpdateDateTime() {
	TDateTime ADate = DateTimePicker->Date;

	Word Year, Month, Day;

	if (ReportType == 1) {
		DecodeDate(ADate - 1, Year, Month, Day);

		DateTimeFrom = TDateTime(Year, Month, Day, 20, 0, 0, 0);

		DecodeDate(ADate, Year, Month, Day);

		DateTimeTo = TDateTime(Year, Month, Day, 19, 59, 59, 999);
	} else {
		DecodeDate(ADate, Year, Month, Day);

		DateTimeFrom = TDateTime(Year, Month, Day, 0, 0, 0, 0);

		DateTimeTo = TDateTime(Year, Month, Day, 23, 59, 59, 999);
	}

	lblDateTime->Caption = Format(IDS_DATETIME_LABEL,
		ARRAYOFCONST((DTToS(DateTimeFrom), DTToS(DateTimeTo))));
}
示例#24
0
//---------------------------------------------------------------------------
TDateTime __fastcall TFileOperationProgressType::TotalTimeLeft()
{
  assert(TotalSizeSet);
  unsigned int CurCps = CPS();
  // sanity check
  if ((CurCps > 0) && (TotalSize > TotalSkipped + TotalTransfered))
  {
    return TDateTime((double)((double)(TotalSize - TotalSkipped - TotalTransfered) / CurCps) /
      SecsPerDay);
  }
  else
  {
    return 0;
  }
}
示例#25
0
//---------------------------------------------------------------------------
bool TryEncodeDate(int Year, int Month, int Day, TDateTime & Date)
{
  const TDayTable * DayTable = &MonthDays[IsLeapYear(static_cast<Word>(Year))];
  if ((Year >= 1) && (Year <= 9999) && (Month >= 1) && (Month <= 12) &&
      (Day >= 1) && (Day <= (*DayTable)[Month - 1]))
  {
    for (int I = 1; I <= Month - 1; I++)
    {
      Day += (*DayTable)[I - 1];
    }
    int I = Year - 1;
    Date = TDateTime((double)(I * 365 + I / 4 - I / 100 + I / 400 + Day - DateDelta));
    return true;
  }
  return false;
}
void __fastcall TContestEntryDetails::EndDateButtonClick(TObject */*Sender*/)
{
   std::auto_ptr <TDateSelectForm> DateSelectDlg( new TDateSelectForm( this ) );
   TDateTime test;
   try
   {
	test = TDateTime( EndDateEdit->Text, TDateTime::Date );
   }
   catch(...)
   {
	   test = TDateTime::CurrentDate();
   }
   DateSelectDlg->CalendarDate = test;
   if ( DateSelectDlg->ShowModal() == mrOk )
   {
	   EndDateEdit->Text = DateSelectDlg->CalendarDate.FormatString( "dd/mm/yy" );
   }
}
示例#27
0
//Empty object with EoB headder
void CReferenceHandler::CreateReferenceObject10L(CObexBufObject& aObject, CBufFlat& /*aObjectBuf*/, TTransport /*aTransport*/)
{
    //Reset the object (also resets the buffer)
    aObject.Reset();

    aObject.SetNameL(KRef8Name);
    aObject.SetTypeL(KRefType);
    const TTime KRef10Time = TDateTime(2005, EJanuary, 17, 14, 35, 30, 0);
    aObject.SetTimeL(KRef10Time);
    aObject.SetTargetL(KRefIrMCTarget);
    TBuf8<40> param;
    param.Copy(_L("\x04"));
    param.Append(_L("\x03"));
    param.Append(_L("PARAM 435"));
    aObject.SetAppParamL(param);

    _LIT8(KRef1HTTP, "Accept: text/*");
    aObject.AddHttpL(KRef1HTTP);

    CObexHeader* header = CObexHeader::NewL();
    CleanupStack::PushL(header);
    _LIT(KUserDefUnicode2, "UserDef2");
    header->SetUnicodeL(0x34, KUserDefUnicode2);
    aObject.AddHeaderL(*header);
    CleanupStack::Pop(header);

    header = CObexHeader::NewL();
    CleanupStack::PushL(header);
    header->SetByte(0xBC, 0x23);
    aObject.AddHeaderL(*header);
    CleanupStack::Pop(header);

    header = CObexHeader::NewL();
    CleanupStack::PushL(header);
    TBuf8<1000> dummy;
    header->SetByteSeqL(TObexInternalHeader::EEndOfBody, dummy);
    aObject.AddHeaderL(*header);
    CleanupStack::Pop(header);


    HBufC* descBuf = HBufC::NewLC(0);
    CleanupStack::PopAndDestroy(descBuf);
}
void CDummyCalendarApp::AddFloatingEntryWithMinStartTimeL()
	{//Defect fix for PDEF111562  - when a floating entry with miniman start time will never get deleted.
	iEntries.ResetAndDestroy();

	_LIT8(KUid, "UID_MinEntry");
	HBufC8* guid = KUid().AllocLC();
	CCalEntry* entry = iTestLib->CreateCalEntryL(CCalEntry::EReminder, guid);
	CleanupStack::Pop(guid);
	CleanupStack::PushL(entry);
	TCalTime caltimestart,caltimeend;
	TTime min(TDateTime(1900, EJanuary, 0, 0, 0, 0, 0));
	caltimestart.SetTimeLocalFloatingL(min);
	entry->SetStartAndEndTimeL(caltimestart,caltimestart);
	iEntries.AppendL(entry);
	CleanupStack::Pop(entry);
	TInt entriesStored(0);
	SynCGetEntryViewL().StoreL(iEntries, entriesStored); //temp
	iEntries.ResetAndDestroy();	
	}
示例#29
0
void MainWindow::GenerateKey(TDes8& aKey, TInt aLen)
        {
        aKey.Zero();

        TTime currentTime;
        currentTime.HomeTime();

        // ??000Ä꿪ʼ¼Æ??
        TInt startYear = 2000;

        // µ±Ç°Äê·Ý
        TInt currentYear = currentTime.DateTime().Year();
        TTime time(TDateTime(currentYear, EJanuary, 0, 0, 0, 0, 0));

        TTimeIntervalSeconds s;
        currentTime.SecondsFrom(time, s);

        // µÃµ½ÃëÊý
        TInt i = s.Int();

        aKey.AppendFormat(_L8("%X"), i);
        aKey.AppendFormat(_L8("%X"), currentYear - startYear);

        TInt len = aKey.Length();
        if (len > aLen)
                {
                aKey.Mid(0, aLen);
                }
        else
                {
                for (TInt i = 0; i < aLen - len; i++)
                        {
                        TTime theTime;
                        theTime.UniversalTime();
                        TInt64 randSeed(theTime.Int64());
                        TInt number(Math::Rand(randSeed) + i);

                        number = number % 10 + 48;
                        aKey.Append(number);
                        }
                }
        }
CCalAlarm* CCalAlarmAttachTest::StoreEntryWithAlarmContentLC(const TDesC8& aUid)
    {
    test.Printf(_L("Store an alarmed entry with alarm content\n"));
    // Create an attachment to the alarm.
    CCalAlarm* alarm = CCalAlarm::NewL();
    CleanupStack::PushL(alarm);
    alarm->SetTimeOffset(1);
    
    CCalContent* almContent = CCalContent::NewL();
    CleanupStack::PushL(almContent);
    // Add content and mimetype for the alarm.
    HBufC8* content = KContent().AllocLC();
    HBufC8* mimetype = KMimeType().AllocLC();
    
    almContent->SetContentL(content, mimetype, CCalContent::EDispositionInline);
    CleanupStack::Pop(mimetype);
    CleanupStack::Pop(content);    
    alarm->SetAlarmAction(almContent); // Takes ownership of almContent.
    CleanupStack::Pop(almContent); 
  
    //Create the entry with the alarm and store it
    RPointerArray<CCalEntry> entries;
    CleanupResetAndDestroyPushL(entries);
    HBufC8* guid = aUid.AllocLC();
    CCalEntry* entry = CCalEntry::NewL(CCalEntry::EEvent, guid, CCalEntry::EMethodNone, 0);
    CleanupStack::Pop(guid);
    CleanupStack::PushL(entry);
    entries.AppendL(entry);
    CleanupStack::Pop(entry);

    TCalTime calTime;
    calTime.SetTimeUtcL(TDateTime(2007,EFebruary,15, 13, 30, 0, 0));
    entry->SetStartAndEndTimeL(calTime, calTime);
    entry->SetSummaryL(KSummary());
    
    entry->SetDescriptionL(KDescription());
    entry->SetAlarmL(alarm);
    TInt entriesStored = 0;
    iTestLib->SynCGetEntryViewL().StoreL(entries, entriesStored);
    CleanupStack::PopAndDestroy(&entries);
    return alarm;
    }