https://github.com/haksham/linux-project
A dynamic web-based simulation of real-time clock (RTC) management and synchronization across OS partitions
https://github.com/haksham/linux-project
expressjs linux-kernel makefile nextjs real-time-clock socket-io
Last synced: 3 months ago
JSON representation
A dynamic web-based simulation of real-time clock (RTC) management and synchronization across OS partitions
- Host: GitHub
- URL: https://github.com/haksham/linux-project
- Owner: Haksham
- License: mit
- Created: 2025-05-24T03:51:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-25T01:31:25.000Z (about 1 year ago)
- Last Synced: 2025-06-22T01:38:17.791Z (about 1 year ago)
- Topics: expressjs, linux-kernel, makefile, nextjs, real-time-clock, socket-io
- Language: JavaScript
- Homepage:
- Size: 1.13 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π Real-Time Clock Partition Simulator
A dynamic, interactive web-based simulation of real-time clock (RTC) management and synchronization across OS partitions.
Built for Linux session.
---
## π Overview
This project demonstrates **master-slave RTC synchronization** in a multi-partition system:
- **Linux** acts as the **Master Partition**, reading time from the hardware clock.
- **Windows OS** and **Ubuntu** are **Slave Partitions** whose clocks can drift and become out of sync.
- You can simulate clock drift, observe out-of-sync states, and manually synchronize all partitionsβjust like using `timedatectl set-local-rtc 1` in Linux.
---
## β¨ Features
- **Live RTC Simulation:** Visualize how clocks drift and sync in real time.
- **Master-Slave Architecture:** Linux (master) always stays in sync; others can drift.
- **Manual & Bulk Sync:** Instantly synchronize all slave partitions with a single click.
- **Visual Feedback:** Out-of-sync states are clearly highlighted.
- **Modern UI:** Responsive, attractive interface using React and Next.js.
- **Command Simulation:** Simulate Linux RTC commands and observe their effects.
---
## πΌοΈ Screenshots
---
## π οΈ Getting Started
### 1. Clone the repository
```bash
git clone https://github.com/yourusername/linux-proj.git
cd linux-proj
```
### 2. Start the RTC Master Server
```bash
cd rtc-sim
npm install
node index.js
```
### 3. Start the Frontend
```bash
cd ../frontend
npm install
npm run dev
```
Open [http://localhost:3000](http://localhost:3000) in your browser.
---
## ποΈ Project Structure
π linux-proj/ (Root)
βββ frontend/ (Next.js frontend)
βΒ Β βββ app/
βΒ Β βΒ Β βββ layout.js
βΒ Β βΒ Β βββ page.js
βΒ Β βΒ Β βββ globals.css
βΒ Β βββ components/
βΒ Β βΒ Β βββ PartitionClock.js
βΒ Β βββ pic/ (Screenshots & images)
βΒ Β βΒ Β βββ p1.png
βΒ Β βΒ Β βββ p2.png
βΒ Β βΒ Β βββ p3.png
βΒ Β βΒ Β βββ p4.png
βΒ Β βΒ Β βββ p5.png
βΒ Β βββ .gitignore
βΒ Β βββ jsconfig.json
βΒ Β βββ next.config.mjs
βΒ Β βββ package.json
βΒ Β βββ postcss.config.mjs
βΒ Β βββ README.md
βΒ Β βββ requirements.txt
βΒ Β βββ tailwind.config.mjs
βββ rtc-sim/ (Node.js backend)
βΒ Β βββ .gitignore
βΒ Β βββ index.js
βΒ Β βββ package.json
βΒ Β βββ requirements.txt
βββ .gitignore
βββ Commands.txt
βββ LICENSE
βββ Makefile
βββ README.md
βββ rtc_slave.c
βββ rtc_sync.c
---
## βοΈ How It Works
- **Master Clock:** The backend (`rtc-sim/index.js`) broadcasts the current time to all partitions.
- **Partitions:** Each partition (component) simulates its own clock, which may drift.
- **Synchronization:** Slave partitions periodically sync to the master, or can be manually synced via UI buttons.
- **Command Simulation:** Use the UI to simulate commands like `timedatectl set-local-rtc 1` for instant synchronization.
---
## π₯οΈ Useful Commands
The following commands (from [`Commands.txt`](Commands.txt)) are useful for working with the kernel RTC module:
```bash
make
sudo insmod rtc_sync.ko
sudo dmesg | grep rtc_shm
ls -l /dev/rtc_shm
cat /dev/rtc_shm
gcc rtc_slave.c -o rtc_slave
sudo ./rtc_slave
sudo rmmod rtc_sync
```
---
## π References
- [Linux Kernel RTC Subsystem](https://www.kernel.org/doc/html/latest/driver-api/rtc.html)
- [timedatectl Documentation](https://www.freedesktop.org/software/systemd/man/latest/timedatectl.html)
- [Socket.io](https://socket.io/)
- [Next.js](https://nextjs.org/)
---
## π¨βπ» Authors
- **Harsh V M**
- **Karthik Hegde**
---
## π License
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.