Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
C# WFA VS: acelera el reloj alternativo del juego conectado a la hora local DateTime.Now

así que encontré un código y lo apliqué a mis necesidades, y parece funcionar, pero ahora necesito hacer lo mismo en C # (para una aplicación) o hacer una aplicación para Windows en javascript. ¿alguna ayuda? aquí está el código:

 const speed = 7; // how many times faster than real time let clockDiv = document.querySelector("#clock"); let gameStartTime = 10800000; // game-milliseconds; let realStartTime = Date.now(); // real milliseconds let timerId = setInterval(function() { let gameTime = gameStartTime + Date.now() * speed; let sec = Math.floor(gameTime / 1000) % 60; let min = Math.floor(gameTime / 60000) % 60; let hour = Math.floor(gameTime / 3600000) % 24; // output in hh:mm:ss format: clockDiv.textContent = `${hour}:${min}:${sec}`.replace(/\b\d\b/g, "0$&"); }, 50);
 <div id="clock" style="font-size:40pt;"></div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

C# Winform:

Diseño principal:

Control requerido:

  1. Etiqueta*1
  2. Temporizador * 1

ingrese la descripción de la imagen aquí

Temporizador:

ingrese la descripción de la imagen aquí ingrese la descripción de la imagen aquí

Código:

 using System; using System.Windows.Forms; namespace WindowsFormsApp3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public static long currentTimeMillis() { return (System.DateTime.UtcNow.Ticks - Jan1st1970Ms) / 10000; } private static long Jan1st1970Ms = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc).Ticks; private void timer1_Tick(object sender, EventArgs e) { const int speed = 7; int gameStartTime = 10800000; Double realStartTime = currentTimeMillis(); var gameTime = gameStartTime + realStartTime * speed; var sec = Math.Floor(gameTime / 1000) % 60; var min = Math.Floor(gameTime / 60000) % 60; var hour = Math.Floor(gameTime / 3600000) % 24; label1.Text = string.Format("{0:00}:{1:00}:{2:00}", hour, min, sec); } } }

Producción:

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!