how to access system time? i am writing my own OS
how to access system time? i am writing my own OS
For my OS i want to display time, date etc. so where will be the system time and how to access it?
Walking my way in making my OS
Re: how to access system time? i am writing my own OS
If you click on the "The OSDev.org Wiki" link above, you will find a chapter with the header "Clocks, Timers and Counters".
Every good solution is obvious once you've found it.
Re: how to access system time? i am writing my own OS
Hi,
Also note that normally you only get the system time from hardware once during boot (either from the RTC or via. a UEFI function), and convert into something like UTC or TAI. After that you maintain your own version of the date and time, typically in an "integer ticks since the epoch" format, using the PIT or HPET or something to measure the (very small) "ticks". This can also mean converting it from your standard representation into "local time wherever the end user happens to be" if/when necessary (and for multi-user systems where people log in remotely, can mean different users in different time zones need to have a different "local time"), including handling things like daylight savings rules for each region.
Cheers,
Brendan
hegde1997 wrote:For my OS i want to display time, date etc. so where will be the system time and how to access it?
Yes.Solar wrote:If you click on the "The OSDev.org Wiki" link above, you will find a chapter with the header "Clocks, Timers and Counters".
Also note that normally you only get the system time from hardware once during boot (either from the RTC or via. a UEFI function), and convert into something like UTC or TAI. After that you maintain your own version of the date and time, typically in an "integer ticks since the epoch" format, using the PIT or HPET or something to measure the (very small) "ticks". This can also mean converting it from your standard representation into "local time wherever the end user happens to be" if/when necessary (and for multi-user systems where people log in remotely, can mean different users in different time zones need to have a different "local time"), including handling things like daylight savings rules for each region.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.