该TimeJobSubmitted
属性似乎没有返回正确时区的时间。当我手动查看 Windows 中的打印队列时,我可以看到作业的时间是正确的。(示例:显示在 3:30 提交的 Job1);
问题是在PrintJobInfoCollection
使用TimeJobSubmitted
视窗。(右键单击打印机并单击“查看正在打印的内容”以查看 Windows 中的打印队列。
这是我在代码中查看打印队列的方式。
LocalPrintServer server = new LocalPrintServer();
PrintQueue pq = server.GetPrintQueue(printerName);
if (pq != null)
{
pq.Refresh();
PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();
foreach (PrintSystemJobInfo job in jobs)
{
string jobName = job.Name;
string jobStatus = job.JobStatus.ToString();
// Why is the next line 5 hours off of the correct time?
DateTime timeSubbited = job.TimeJobSubmitted;
DateTime currentTime = DateTime.Now;;
TimeSpan elapsed = currentTime - timeSubbited;
// double minutesPassed = timePassed.TotalMinutes;
}
}
在 c# 中迭代打印作业时如何获得正确的 TimeJobSubmitted?