Skip to content

Instantly share code, notes, and snippets.

@puppis42
Created May 26, 2023 17:43
Show Gist options
  • Save puppis42/5d17f83ed47282638968e8959d040161 to your computer and use it in GitHub Desktop.
Save puppis42/5d17f83ed47282638968e8959d040161 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Get_Boot_Time
{
public partial class Frm_Main : Form
{
public Frm_Main()
{
InitializeComponent();
}
[DllImport("kernel32")]
extern static UInt64 GetTickCount64();
public static TimeSpan GetUpTime()
{
return TimeSpan.FromMilliseconds(GetTickCount64());
}
private void Frm_Main_Load(object sender, EventArgs e)
{
lbl1.Text = "Boot Time : " + GetUpTime();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment