using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Timer t = new Timer();
t.Elapsed += new ElapsedEventHandler(OnTimedEvent);
t.Interval = 1000;
t.Enabled = true;
Console.Read();
}
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Console.Clear();
Console.WriteLine(DateTime.Now);
}
}
}
原文:https://blog.csdn.net/yiwangxiblog/article/details/74009170