BIOS pili saati ilerletmeyecek kadar bitmiş durumda bende bu saati güncelle demekten yoruldum, BIOS pili lehimli olmasa sökerdim ama işte, saati internet aracılığıyla güncel tutacak program biliyor musunuz?
Otomatik saat güncellemeyi kapatın. Saat dilimini +3 İstanbul seçin. Rar'dan dosyayı çıkarın. Yönetici olarak çalıştırın. 30 saniyede bir saatiniz güncellenir.
Kaynak kodları:
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;
using System.Runtime.InteropServices;
using System.Net;
using System.Net.Sockets;
namespace zaman_guncelle
{
public partial class Form1 : Form
{
int sayac = 0;
[DllImport("kernel32.dll")]
public extern static uint SetSystemTime(ref SYSTEMTIME lpSystemTime);
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEMTIME
{
public short Year;
public short Month;
public short DayOfWeek;
public short Day;
public short Hour;
public short Minute;
public short Second;
public short Milliseconds;
}
public Form1()
{
InitializeComponent();
guncelle();
timer1.Start();
}
void guncelle()
{
SYSTEMTIME zaman = new SYSTEMTIME();
zaman.Day = (short)(GetNetworkTime().Day);
zaman.Month = (short)(GetNetworkTime().Month);
zaman.Year = (short)(GetNetworkTime().Year);
zaman.Hour = (short)(GetNetworkTime().Hour);
zaman.Minute = (short)(GetNetworkTime().Minute);
zaman.Second = (short)(GetNetworkTime().Second);
zaman.Milliseconds = (short)(GetNetworkTime().Millisecond);
SetSystemTime(ref zaman);
textBox1.Text = GetNetworkTime().ToString();
}
public static DateTime GetNetworkTime()
{
const string ntpServer = "0.tr.pool.ntp.org";
var ntpData = new byte[48];
ntpData[0] = 0x1B; //LeapIndicator = 0 (no warning), VersionNum = 3 (IPv4 only), Mode = 3 (Client Mode)
var addresses = Dns.GetHostEntry(ntpServer).AddressList;
var ipEndPoint = new IPEndPoint(addresses[0], 123);
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.Connect(ipEndPoint);
socket.Send(ntpData);
socket.Receive(ntpData);
socket.Close();
ulong intPart = (ulong)ntpData[40] << 24 | (ulong)ntpData[41] << 16 | (ulong)ntpData[42] << 8 | (ulong)ntpData[43];
ulong fractPart = (ulong)ntpData[44] << 24 | (ulong)ntpData[45] << 16 | (ulong)ntpData[46] << 8 | (ulong)ntpData[47];
var milliseconds = (intPart * 1000) + ((fractPart * 1000) / 0x100000000L);
var networkDateTime = (new DateTime(1900, 1, 1)).AddMilliseconds((long)milliseconds);
return networkDateTime;
}
private void timer1_Tick(object sender, EventArgs e)
{
sayac++;
if (sayac%30==0)
{
guncelle();
}
}
}
}
BIOS pili saati ilerletmeyecek kadar bitmiş durumda bende bu saati güncelle demekten yoruldum, BIOS pili lehimli olmasa sökerdim ama işte, saati internet aracılığıyla güncel tutacak program biliyor musunuz?
Pil bildiğimiz yuvarlak pildir. Anakartların farklı bir pil ile çalıştığını düşünmüyorum, uyacaktır yalnız sökme videolarını izlediğimde pilin yerini bulamadım bu adamlar nasıl bir dizayn yapmışlarsa.
Pil bildiğimiz yuvarlak pildir. Anakartların farklı bir pil ile çalıştığını düşünmüyorum, uyacaktır yalnız sökme videolarını izlediğimde pilin yerini bulamadım bu adamlar nasıl bir dizayn yapmışlarsa.
Böyle pil lehimini de ilk kez görüyorum sanırsın BIOS pili ömrü 30 yıl falan. Ne yalan söyleyeyim böyle bir durumda garantisi bitmiş olsa bile servisin ücretsiz pil değişimi/destek sağlaması lazım.