我想知道如何使用C#在服务器上运行任务以获得时间 [英] I want to know how do I get the time since a task is running on a server using C#

查看:59
本文介绍了我想知道如何使用C#在服务器上运行任务以获得时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用C#在服务器上运行任务以获得时间


我可以让任务运行,最后一次运行时间,当前状态,但我如何编程以检查任务是否自启动以来已运行多长时间。



我尝试过:



我能够运行任务,上次运行时间,当前状态,但我如何编程以检查任务是否正在运行从它开始的时间开始。

I want to know how do i get the time since a task is running on a server using C#

I am able to get the task running, last run time , current state, but how do i program to check if the task is running for how long since the time it started.

What I have tried:

I am able to get the task running, last run time , current state, but how do i program to check if the task is running for how long since the time it started.

推荐答案





您可以简单地记住(文件?)您的任务开始运行的时间戳。

然后从客户端您可以检索此文件,解析其内容,获取当前时间戳并从后者中减去前者。



希望这有助于
Hi,

You can simply memorize (file?) the timestamp in which your task started running.
Then from the client you can retrieve this file, parse its content, get the current timestamp and subtract the former from the latter.

Hope this helps


这篇关于我想知道如何使用C#在服务器上运行任务以获得时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆