C# (CSharp) System. DateTime Code Examples

C# (CSharp) System.DateTime - 30 examples found. These are the top rated real world C# (CSharp) examples of System.DateTime extracted from open source projects. You can rate examples to help us improve the quality of examples
		protected override bool ComparePropertyValue(IOguObject srcOguObject, string srcPropertyName, ADObjectWrapper adObject, string targetPropertyName, string context)
		{
			DateTime dtResult = DateTime.MinValue;
			long adAccountExpiresValue = Convert.ToInt64(adObject.Properties[targetPropertyName]);

			try
			{
				if (adAccountExpiresValue != SynchronizeHelper.ACCOUNT_EXPIRES_MAX_VALUE)
				{
					if (adAccountExpiresValue != 0)
					{
						DateTime dt = DateTime.FromFileTime(adAccountExpiresValue);

						//舍弃掉毫秒
						dtResult = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Millisecond);
					}
				}
			}
			catch (System.ArgumentOutOfRangeException)
			{
				dtResult = DateTime.MaxValue;
			}

			dtResult = SynchronizeContext.Current.ADHelper.GetUserAccountExpirationDate(dtResult);
			var accountExpiresDate = Convert.ToDateTime(srcOguObject.Properties[srcPropertyName]);

			return accountExpiresDate == dtResult;
		}
Example #2
0
 public Point AddPoint(float value, DateTime timestamp)
 {
     var p = new Point(value, timestamp);
     _points.Add(p);
     _lastPoint = p;
     return p;
 }
Example #3
0
	public Event(string venue, double lat, double lng, DateTime date)
	{
		this.Venue = venue;
		this.Latitude = lat;
		this.Longitude = lng;
		Date = date;
	}
        /// <summary>
        /// Inserts a row in the mp_ContentWorkflow table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="createdDateUtc"> createdDateUtc </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="status"> status </param>
        /// <param name="contentText"> contentText </param>
        /// <param name="customData"> customData </param>
        /// <param name="customReferenceNumber"> customReferenceNumber </param>
        /// <param name="customReferenceGuid"> customReferenceGuid </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid userGuid,
            DateTime createdDateUtc,
            string contentText,
            string customData,
            int customReferenceNumber,
            Guid customReferenceGuid,
            string status)
        {
            SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_ContentWorkflow_Insert", 10);
            sph.DefineSqlParameter("@Guid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, guid);
            sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
            sph.DefineSqlParameter("@ModuleGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, moduleGuid);
            sph.DefineSqlParameter("@CreatedDateUtc", SqlDbType.DateTime, ParameterDirection.Input, createdDateUtc);
            sph.DefineSqlParameter("@UserGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, userGuid);
            sph.DefineSqlParameter("@Status", SqlDbType.NVarChar, 20, ParameterDirection.Input, status);
            sph.DefineSqlParameter("@ContentText", SqlDbType.NVarChar, -1, ParameterDirection.Input, contentText);
            sph.DefineSqlParameter("@CustomData", SqlDbType.NVarChar, -1, ParameterDirection.Input, customData);

            //object customReferenceNumberVal = customReferenceNumber.HasValue ? (object)customReferenceNumber.Value : DBNull.Value;
            sph.DefineSqlParameter("@CustomReferenceNumber", SqlDbType.Int, ParameterDirection.Input, customReferenceNumber);

            //object customReferenceGuidVal = customReferenceGuid.HasValue ? (object)customReferenceGuid.Value : DBNull.Value;
            sph.DefineSqlParameter("@CustomReferenceGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, customReferenceGuid);

            int rowsAffected = sph.ExecuteNonQuery();
            return rowsAffected;
        }
		public TraceEventCache ()
			{
#if SSHARP
			started = DateTimePrecise.Now;
#else
			started = DateTime.Now;
#endif
#if NETCF
			try
				{
				throw new ApplicationException ();
				}
			catch (ApplicationException aex)
				{
				callstack = aex.StackTrace;
				}
#else
			manager = Trace.CorrelationManager;
			callstack = Environment.StackTrace;
#endif
			timestamp = Stopwatch.GetTimestamp ();
#if SSHARP
			process = (int)Crestron.SimplSharp.InitialParametersClass.ApplicationNumber;
#if SSHARP_PRO
			thread = CurrentThread.Name;
#else
			thread = String.Empty;
#endif
#else
			thread = Thread.CurrentThread.Name;
			process = Process.GetCurrentProcess ().Id;
#endif
			}
Example #6
0
 public StudyDeleteRecord(
      String _studyInstanceUid_
     ,DateTime _timestamp_
     ,String _serverPartitionAE_
     ,ServerEntityKey _filesystemKey_
     ,String _backupPath_
     ,String _reason_
     ,String _accessionNumber_
     ,String _patientId_
     ,String _patientsName_
     ,String _studyId_
     ,String _studyDescription_
     ,String _studyDate_
     ,String _studyTime_
     ,XmlDocument _archiveInfo_
     ,String _extendedInfo_
     ):base("StudyDeleteRecord")
 {
     StudyInstanceUid = _studyInstanceUid_;
     Timestamp = _timestamp_;
     ServerPartitionAE = _serverPartitionAE_;
     FilesystemKey = _filesystemKey_;
     BackupPath = _backupPath_;
     Reason = _reason_;
     AccessionNumber = _accessionNumber_;
     PatientId = _patientId_;
     PatientsName = _patientsName_;
     StudyId = _studyId_;
     StudyDescription = _studyDescription_;
     StudyDate = _studyDate_;
     StudyTime = _studyTime_;
     ArchiveInfo = _archiveInfo_;
     ExtendedInfo = _extendedInfo_;
 }
Example #7
0
 public Temblor[] GetTembloresByDate(DateTime fecha)
 {
     var temblores = from t in repository.All<Temblor>()
                     where t.Fecha >= fecha.Date && t.Fecha < fecha.Date.AddDays(1)
                     select t;
     return temblores.ToArray();
 }
Example #8
0
 public static int Add(
     Guid pollGuid,
     Guid siteGuid,
     String question,
     bool anonymousVoting,
     bool allowViewingResultsBeforeVoting,
     bool showOrderNumbers,
     bool showResultsWhenDeactivated,
     bool active,
     DateTime activeFrom,
     DateTime activeTo)
 {
     SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Polls_Insert", 10);
     sph.DefineSqlParameter("@PollGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, pollGuid);
     sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
     sph.DefineSqlParameter("@Question", SqlDbType.NVarChar, 255, ParameterDirection.Input, question);
     sph.DefineSqlParameter("@AnonymousVoting", SqlDbType.Bit, ParameterDirection.Input, anonymousVoting);
     sph.DefineSqlParameter("@AllowViewingResultsBeforeVoting", SqlDbType.Bit, ParameterDirection.Input, allowViewingResultsBeforeVoting);
     sph.DefineSqlParameter("@ShowOrderNumbers", SqlDbType.Bit, ParameterDirection.Input, showOrderNumbers);
     sph.DefineSqlParameter("@ShowResultsWhenDeactivated", SqlDbType.Bit, ParameterDirection.Input, showResultsWhenDeactivated);
     sph.DefineSqlParameter("@Active", SqlDbType.Bit, ParameterDirection.Input, active);
     sph.DefineSqlParameter("@ActiveFrom", SqlDbType.DateTime, ParameterDirection.Input, activeFrom);
     sph.DefineSqlParameter("@ActiveTo", SqlDbType.DateTime, ParameterDirection.Input, activeTo);
     int rowsAffected = sph.ExecuteNonQuery();
     return rowsAffected;
 }
Example #9
0
		public void CanStoreAndRetrieveTime(DateTime expectedTime)
		{
			//  Only supporting accuracy up to the millisecond
			expectedTime = new DateTime(expectedTime.Year, expectedTime.Month, expectedTime.Day, expectedTime.Hour, expectedTime.Minute, expectedTime.Second, expectedTime.Millisecond, expectedTime.Kind);

			using (var store = NewDocumentStore())
			{
				using (var session = store.OpenSession())
				{
					session.Store(new Post
					{
						PostedAt = expectedTime,
						Tags = new List<string> { "C#", "Programming", "NoSql" }
					});
					session.SaveChanges();
				}

				using (var session = store.OpenSession())
				{
					var posts = session.Query<Post>()
						.Customize(q => q.WaitForNonStaleResultsAsOfNow(TimeSpan.FromSeconds(5)))
						.ToArray();

					Assert.Equal(1, posts.Length);
					Assert.Equal(expectedTime, posts[0].PostedAt);
				}
			}
		}
 /// <summary>
 /// Sets a persistent cookie with an expiresAt date
 /// </summary>
 public static void SetCookie(this IHttpResponse httpRes, string cookieName,
     string cookieValue, DateTime expiresAt, string path = "/")
 {
     httpRes.Cookies.AddCookie(new Cookie(cookieName, cookieValue, path) {
         Expires = expiresAt,
     });
 }
Example #11
0
 protected static string ConvertToDisplayDateTime(DateTime? utcDateTime)
 {
     // You can change this method to convert the UTC date time into the desired display
     // offset and format. Here we're converting it to the server timezone and formatting
     // as a short date and a long time string, using the current thread culture.
     return utcDateTime.HasValue ? utcDateTime.Value.ToLocalTime().ToString("G") : "[never]";
 }
Example #12
0
        /// <summary>
        /// Queries the calendar for events matching the specified criteria.
        /// </summary>
        /// <param name="fullTextQuery"></param>
        /// <param name="from"></param>
        /// <param name="until"></param>
        /// <returns></returns>
        public CalendarEvent[] GetEvents(string fullTextQuery, DateTime? from, DateTime? until)
        {
            EventQuery query = new EventQuery();

            query.Uri = new Uri(CALENDAR_URI);

            query.Query = fullTextQuery;

            if (from != null)
            {
                query.StartTime = from.Value;
            }

            if (until != null)
            {
                query.EndTime = until.Value;
            }

            EventFeed calFeed = _service.Query(query);

            List<CalendarEvent> events = CollectionUtils.Map<EventEntry, CalendarEvent, List<CalendarEvent>>(calFeed.Entries,
                delegate(EventEntry e) { return new CalendarEvent(e); });
            events.Sort();
            return events.ToArray();
        }
Example #13
0
		private string GetDateTime( DateTime val )
		{
			if ( val == DateTime.MinValue )
				return "";

			return val.ToString( "yyyy'-'MM'-'dd HH':'mm':'ss" );
		}
 public Person(int _id, string _name, int _age, DateTime _birth)
 {
     ID = _id;
     Name = _name;
     Age = _age;
     Birth = _birth;
 }
        // Calcul des refinancements
        public IQueryable<Refinancement> Produire(DateTime dateArchivage)
        {
            // INitialisation des budgets
            IQueryable<Budget> _budgets = uow.Budget
                .GetAllByGroupeId(groupeId)
                .Include(b => b.BudgetEquilibre)
                .Where(b => b.IsActive == true)
                .Where(b => b.RefinancementImmediat == true)
                .Where(b => b.TypeNonAlloue != true) // Exclusion des budgets de type 'non alloué'
                ;

            // Calculs des écarts
            var _budgetsHorsReserve = _budgets.Where(b => b.IsBudgetEquilibre != true); // Exclusion des budgets de type réserve de financement (Budget equilibre)
            IList<Refinancement> _refis = fabriqueRefi.Make(_budgetsHorsReserve, dateArchivage);

            // Il faut maintenant ajouter les budgets réserve
            var _reserves = _budgets.Where(b => b.IsBudgetEquilibre == true);
            IList<Refinancement> _refiReserves = fabriqueRefi.Make(_reserves, dateArchivage);
            CalculerRefinancementReserves(_refis, _refiReserves);

            // Retour
            return _refis
                .Where(e => e.MontantRefinancement != 0)
                .OrderBy(e => e.MontantEcart)
                .AsQueryable<Refinancement>();
        }
Example #16
0
        public DateClause( DateTime from, DateTime to )
        {
            DateTimeExtensions.NormalizeRange( ref from, ref to );

            From = from.Date;
            To = to.Date;
        }
Example #17
0
        public Capability(string issuerId, DateTime expiryTime)
        {
            this.issuerId = issuerId;
            this.expiryTime = expiryTime;

            randomVal = randGenerator.Next();
        }
Example #18
0
        public Announcement(string description, string type, string operatorName, DateTime? startDate, DateTime? endDate, Coordinate location, IEnumerable<string> modes)
        {
            this.OperatorName = operatorName;
            this.Description = description;
            this.StartDate = startDate;
            this.EndDate = endDate;
            this.Location = location;
            this.Type = type;
            this.Modes.AddRange(modes);
            this.RelativeDateString = TimeConverter.ToRelativeDateString(StartDate, true);

            if (modes != null)
            {
                if (modes.Select(x => x.ToLower()).Contains("bus"))
                    this.ModeImages.Add("/Images/64/W/ModeBus.png");
                if (modes.Select(x => x.ToLower()).Contains("rail"))
                    this.ModeImages.Add("/Images/64/W/ModeRail.png");
                if (modes.Select(x => x.ToLower()).Contains("taxi"))
                    this.ModeImages.Add("/Images/64/W/ModeTaxi.png");
                if (modes.Select(x => x.ToLower()).Contains("boat"))
                    this.ModeImages.Add("/Images/64/W/ModeBoat.png");

                if (!this.ModeImages.Any())
                    this.ModeImages.Add("/Images/64/W/ModeBus.png");
            }
            else
            {
                this.Modes.Add("bus");
                this.ModeImages.Add("/Images/64/W/ModeBus.png");
            }
        }
Example #19
0
        public override void Update()
        {
            // Bounding Box
            rectangle = new Rectangle
            (
                (int)Position.X,
                (int)Position.Y,
                (int)Size.X,
                (int)Size.Y
            );

            KeyboardState keyboardState = Keyboard.GetState();
            if (Keyboard.GetState().IsKeyDown(Keys.D))
            {
                Position += movingVector;
                body.ApplyLinearImpulse(movingImpulse);
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.A))
            {
                Position -= movingVector;
                body.ApplyLinearImpulse(-movingImpulse);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.W) && !prevKeyboardState.IsKeyDown(Keys.W))
            {
                if ((DateTime.Now - previousJump).TotalSeconds >= jumpInterval)
                {
                    jumpEffect.Play();
                    body.ApplyLinearImpulse(jumpingImpulse);
                    previousJump = DateTime.Now;
                }
            }

            prevKeyboardState = keyboardState;
        }
Example #20
0
        /// <inheritdoc/>
        public async Task<Uri> UploadMessageAsync(Stream content, DateTime expirationUtc, string contentType, string contentEncoding, IProgress<int> bytesCopiedProgress, CancellationToken cancellationToken = default(CancellationToken))
        {
            Requires.NotNull(content, "content");
            Requires.Range(expirationUtc > DateTime.UtcNow, "expirationUtc");

            string blobName = Utilities.CreateRandomWebSafeName(DesktopUtilities.BlobNameLength);
            if (expirationUtc < DateTime.MaxValue)
            {
                DateTime roundedUp = expirationUtc - expirationUtc.TimeOfDay + TimeSpan.FromDays(1);
                blobName = roundedUp.ToString("yyyy.MM.dd") + "/" + blobName;
            }

            var blob = this.container.GetBlockBlobReference(blobName);

            // Set metadata with the precise expiration time, although for efficiency we also put the blob into a directory
            // for efficient deletion based on approximate expiration date.
            if (expirationUtc < DateTime.MaxValue)
            {
                blob.Metadata["DeleteAfter"] = expirationUtc.ToString(CultureInfo.InvariantCulture);
            }

            blob.Properties.ContentType = contentType;
            blob.Properties.ContentEncoding = contentEncoding;

            await blob.UploadFromStreamAsync(content.ReadStreamWithProgress(bytesCopiedProgress), cancellationToken);
            return blob.Uri;
        }
 public static void PrintOnConsole(string homeTeamName, string awayTeamName, int homeTeamScore, 
     int awayTeamScore, string league, DateTime date)
 {
     var stringDate = date.ToString("dd-MMM-yyyyy");
     Console.WriteLine("{0}: {1} - {2}: {3}-{4} ({5})", stringDate, homeTeamName, awayTeamName, homeTeamScore, awayTeamScore,
         league);
 }
Example #22
0
	protected Revision (Repository repo, DateTime time, string author, string message)
	{
		this.repo = repo;
		this.Time = time;
		this.Author = author;
		this.Message = message;
	}
Example #23
0
        public Organisation(
            User createdByUser,
            string name,
            string description,
            string website,
            MediaResource avatar,
            MediaResource background,
            IEnumerable<string> categories,
            DateTime createdDateTime,
            Group parentGroup)
            : base(createdByUser,
            name,
            createdDateTime,
            parentGroup)
        {
            Check.RequireNotNull(categories != null, "categories");

            InitMembers();

            SetOrganisationDetails(
                description,
                website,
                avatar,
                background,
                categories);

            ApplyEvent(new DomainModelCreatedEvent<Organisation>(this, createdByUser, this));
        }
Example #24
0
        private void ReadExif()
        {
            IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(this.path);
            var subIfdDirectory = directories.OfType<ExifSubIfdDirectory>().FirstOrDefault();
            var mainIfdDirectory = directories.OfType<ExifIfd0Directory>().FirstOrDefault();

            try
            {
                this.dateTaken = Convert.ToDateTime(mainIfdDirectory.GetDescription(ExifDirectoryBase.TagDateTime));
                this.manufacturer = mainIfdDirectory.GetDescription(ExifDirectoryBase.TagMake);
                this.model = mainIfdDirectory.GetDescription(ExifDirectoryBase.TagModel);

                this.iso = Convert.ToInt32(subIfdDirectory?.GetDescription(ExifDirectoryBase.TagIsoEquivalent));
                this.fStop = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagFnumber);
                this.exposureTime = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagExposureTime);
                this.program = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagExposureProgram);
                this.metering = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagMeteringMode);
                this.flashMode = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagFlash);
                string tempFocal = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagFocalLength);
                this.focalLength = Convert.ToInt32(tempFocal.Substring(0, tempFocal.Length - 3));
                this.valid = true;
            }
            catch
            {
                this.valid = false;
                return;
            }
        }
Example #25
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
			}
			else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse )
			{
				Point3D p = GetWorldLocation();

				if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
				{
					Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
					from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
					SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
				}

				Effects.PlaySound( GetWorldLocation(), Map, 0x387 );

				Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
				Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );

				Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );

				m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
			}
		}
        public void Execute(ISession session, long taskId, DateTime sentDate)
        {
            bool closeSession = false;
            if (session == null)
            {
                session = _businessSafeSessionManager.Session;
                closeSession = true;
            }

            var systemUser = session.Load<UserForAuditing>(SystemUser.Id);

            var taskDueTomorrowEscalation = new EscalationTaskDueTomorrow()
            {
                TaskId = taskId,
                TaskDueTomorrowEmailSentDate = sentDate,
                CreatedBy = systemUser,
                CreatedOn = DateTime.Now
            };
            session.Save(taskDueTomorrowEscalation);

            //Log4NetHelper.Log.Debug("Saved EscalationTaskDueTomorrow sent indicator");

            if (closeSession)
            {
                session.Close();
            }
        }
        public MFTestResults TimerTest0()
        {
            MFTestResults result = MFTestResults.Pass;
            try
            {
                timerEvent.Reset();
                /// Save the current time shifted by 5 hours.
                
                timerTime = DateTime.UtcNow - utcTimeShiftAmount;
                using (Timer t = new Timer(new TimerCallback(TimerCallback), null, new TimeSpan(0, 0, 30), new TimeSpan(-TimeSpan.TicksPerMillisecond)))
                {
                    /// We shift the utc back by 5 hours.
                    TimeService.SetUtcTime(timerTime.Ticks); 
                    
                    /// timer should still fire after 30 seconds even though absolute time has been manipulated.
                    if (!timerEvent.WaitOne(2 * 60 * 1000, false))
                    {
                        result = MFTestResults.Fail;
                    }

                    /// Reset the changes.
                    TimeService.SetUtcTime((DateTime.UtcNow + utcTimeShiftAmount).Ticks);

                    t.Change(-1, -1);
                }
            }
            catch (Exception ex)
            {
                Log.Exception("Unexpected exception", ex);
                result = MFTestResults.Fail;
            }

            return result;
        }
Example #28
0
 public Watcher(String path, Client client)
 {
     this.client = client;
     this.path = path;
     lastRead = DateTime.MinValue;
     this.Run();
 }
        public static DateTime Merge(DateTime date, string time)
        {
            int[] components = time.Split(':').Select(int.Parse).ToArray();

            return new DateTime(date.Year, date.Month, date.Day, components[0], components[1],
                                components[2]);
        }
Example #30
0
        public ViewModel()
        {
            mgt = new ManagementClass("Win32_Processor");
            procs = mgt.GetInstances();

            CPU = new ObservableCollection<Model>();
            timer = new DispatcherTimer();
            random = new Random();
            time = DateTime.Now;
            cpuCounter = new PerformanceCounter();
            cpuCounter.CategoryName = "Processor";
            cpuCounter.CounterName = "% Processor Time";
            cpuCounter.InstanceName = "_Total";
            ramCounter = new PerformanceCounter("Memory", "Available MBytes");
            ProcessorID = GetProcessorID();
            processes = Process.GetProcesses();
            Processes = processes.Length;
            MaximumSpeed = GetMaxClockSpeed();
            LogicalProcessors = GetNumberOfLogicalProcessors();
            Cores = GetNumberOfCores();
            L2Cache = GetL2CacheSize();
            L3Cache = GetL3CacheSize();
            foreach (ManagementObject item in procs)
                L1Cache = ((UInt32)item.Properties["L2CacheSize"].Value / 2).ToString() + " KB";

            timer.Interval = TimeSpan.FromMilliseconds(1000);
            timer.Tick += timer_Tick;
            timer.Start();
            for (int i = 0; i < 60; i++)
            {
                CPU.Add(new Model(time, 0,0));
                time = time.AddSeconds(1);
            }
        }