I am using quartz.net to close the machine in supermarket,when at 22:00.Trigger the shutdown event:
public void Execute(IJobExecutionContext context)
{
logger.Info("shutdown.....");
try
{
StatusHelper.ShutdownComputerImpl(MachineOperType.Shutdown);
}
catch (Exception e)
{
logger.Error("Shutdown computer encount an error", e);
}
}
But the quartz.net will trigger the job when first time run!!!!
So I could get the system already run how much time, if less than 10 minutes, the function could not be execute.Like this:
public void Execute(IJobExecutionContext context)
{
logger.Info("shutdown.....");
try
{
if(GetCurrentProcessRuntime()>50)
{
StatusHelper.ShutdownComputerImpl(MachineOperType.Shutdown);
}
}
catch (Exception e)
{
logger.Error("Shutdown computer encount an error", e);
}
}
I am programming in C# Winform,visual studio 2013,and i want to get the program run time from start,how to get it?May be the program run 2 hours,and the time will more than 2 hour(or minutes).
I am not measure the code run how much time,I want to get system run time from start!!!