Skip to content

Instantly share code, notes, and snippets.

@puppis42
Created May 26, 2023 17:45
Show Gist options
  • Select an option

  • Save puppis42/8918c3c7679974dacb7b9f197a4f71e1 to your computer and use it in GitHub Desktop.

Select an option

Save puppis42/8918c3c7679974dacb7b9f197a4f71e1 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.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace computer_get_up_time
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public string getuptime()
{
String gg = String.Empty;
gg += Convert.ToString(Environment.TickCount / 86400000) + " Day(s), ";
gg += Convert.ToString(Environment.TickCount / 3600000 % 24) + " hh, ";
gg += Convert.ToString(Environment.TickCount / 120000 % 60) + " min, ";
gg += Convert.ToString(Environment.TickCount / 1000 % 60) + " ss.";
return gg;
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = getuptime();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment