Sitemap

Building a Dual Clock for Windows: Why the Default Solution Fails and How to Fix It

11 min read Just now

You’re sitting at your PC. You work across timezones, maybe with teammates in Berlin, customers in Toronto, and a boss who lives somewhere between Excel spreadsheets and hell while physically located in Thailand. You would want to instantly know what time it is in another part of the world.

What do you do?

If you’re using Windows, you hover over the tray clock. That’s great — if you happen to be in the current timezone. Need Tokyo time? Well, click the clock, open the calendar, and you’ll see a pale second clock in tiny font, tucked in like an afterthought. That’s Microsoft’s idea of “dual clocks.” Elegant? No. Intuitive? Hardly. Functional? Barely.

Windows default dual clock

I don’t believe at all that the default Windows dual clock is a solution to the problem of instantly viewing time in multiple parts of the world. Here is a answer for practically daily struggles of displaying multiple timezones in Windows.

The Default Dual Clock in Windows: Functionally Present, Visually Absent

To be fair, Windows technically supports additional clocks. You can configure them under Date & Time settings — if you manage to find the right window. Up to two additional timezones, shown in a calendar tooltip when you hover the system clock.

Not “shown” as in “always visible”. Shown as in “you must hover a mouse to open an overlay or initiate a click, and scan with your eyes for smaller text embedded between dates.” Not a persistent readout. Just a tooltip disguised as a feature.

It works. Technically. But if you’re in the global business, glancing at clocks becomes your daily job. And currently it’s not great. The real-time information is obscured. Like putting a speedometer in the glove compartment.

The Landscape of Third-Party Dual Clock Solutions

Over the years, several third-party developers have taken a swing at solving this. The results range from mildly helpful to conceptually fascinating, but most stumble over the same root problems.

  • ClocX: An old-school app that draws analog clocks on your desktop. Configurable skins and floating widgets — but only on the desktop layer. Switch windows, and it’s gone behind them like a shy cat.
  • Free Desktop Clock: Offers decorative replacements for the system tray clock, complete with themes and effects. But it replaces Explorer UI components and may behave unpredictably after system updates or Explorer restarts.
  • T-Clock: A technically impressive tool that hooks into undocumented Windows APIs to modify the tray clock directly. Arguably the most robust of the bunch, but also the riskiest. If Windows changes internal behavior — as it does regularly — T-Clock might stop working or throw errors silently.

All of these solutions struggle with the same constraints: either they live outside the system tray and risk being hidden or buried, or they fight Windows itself, injecting code into Explorer and hoping nothing breaks.

And we haven’t even mentioned the joys of DPI scaling, icon visibility policies, or Windows Defender mistaking your clock for malware.

We Built Our Own Dual Time Clock: DualTimeClockTray.exe

Eventually, the only viable option was to take a very different approach. Rather than modifying or replacing the existing clock, we decided to simply add a second one. In the system tray. Right next to the original.

Launching DualTimeClockTray.exe

And since the tray doesn’t allow large text or customization, we had to get creative. The solution? Two tray icons. One for hours, one for minutes. Hover on any icon to get the more information beside the current time: the full date, and selected timezone.

This is DualTimeClockTray.exe, a tray-resident application written in barebones C++ with no external dependencies. It doesn’t pretend to be elegant. It’s practical, and minimal.

The Major Problem: Windows Tray Icons

Creating the dual time clock for WIndows system tray was fairly easy, and after a half an hour of talking with AI and installing a C++ compiler on a Windows, a functional prototype was ready. Then it got messy.

Here’s the catch: Windows tray icons are small. Between 16×16 and 32×32 pixels depending on system DPI. That’s enough for a bell or battery symbol — not enough for readable text like “14:57.”

To solve this, we split the time (e.g., 14:57) across two icons:

  • The first icon shows hours (e.g., 14)
  • The second icon shows minutes (e.g., 57)

This not only improves legibility, but also sidesteps the pixel constraint. Each icon is purpose-built with one job: draw part of the time and be visible in the tray. It works surprisingly well.

But there’s a wrinkle. Of course.

The Tray Icon Visibility Problem

You add two icons. You expect to see them both. Windows, trying to “help”, decides that one of them does not deserve a visible spot and hides it. There is no such option to explicitly mark both icons as “always show”, they might still be hidden or shuffled by system logic after reboots or DPI changes.

To work around this, we implemented two tray icon persistence methods:

1. The “Three Icons” Strategy

Here, the app spawns three icons:

  • One with a symbolic “C” (for Clock),
  • One for hours,
  • One for minutes.

The first icon is deliberately designed to be hidden. Once Windows hides it (which it predictably does), the hour and minute icons remain visible and unmolested.

In short, we bait the OS into hiding the icon we can afford to hide.

2. The “Redraw” Strategy

Instead of waiting for Windows to hide an icon, we preemptively remove and recreate them on a timer. Every 30 seconds, we destroy and recreate both icons. The theory? If you’re faster than Windows’ hide logic, you win.

And it works.

You can choose your preferred method via a right-click tray menu. App even remembers your choice between reboots, thanks to registry persistence.

Absurd limitations in UX isn’t Just a Windows Problem

Before anyone accuses us of being unfair to Microsoft, let’s acknowledge: this isn’t a problem unique to Windows. Every modern OS has made equally confusing, limiting decisions when it comes to making really user friendly UX.

Let’s take a world tour of disappointing time UX:

  • macOS: The menu bar shows one clock. Want more? You can add world clocks to the Notification Center, which appears only when summoned. No persistent view. No multiple menu clocks.
  • iOS: The “Clock” app allows multiple timezones, but these are confined inside the app. No way to pin multiple timezones to the lock screen. The widget approach helps — sort of — but space is limited and formatting is inconsistent.
  • Android: Some launchers support dual clocks on the home screen. But it’s not a native behavior, and implementations vary wildly. Most users rely on widgets or custom launchers.
  • Ubuntu (GNOME desktop): Displays one clock in the top bar. World clocks can be added to the calendar dropdown, but they’re buried and non-interactive. It’s functional, but again, not visible unless clicked.

Bottom line: while designers claim to enhance user interfaces, they actually do the opposite. Multi-timezone clocks are just a tiny example of that big pile of unsolved artificially created UX problems across all major platforms.

Behind the Code: C++ and Win32, No Dependencies

The app is written in the simplest C++ possible. No frameworks. No libraries. No Qt, MFC, or .NET.

Key components:

  • Tray Icon Drawing: We generate icons dynamically using GDI. Each number (e.g., 14, 57) is rendered to a bitmap and converted into an HICON.
  • Time Conversion: Uses SystemTimeToTzSpecificLocalTimeEx() to convert UTC to your selected timezone. On Windows 7, it falls back to the older SystemTimeToTzSpecificLocalTime().
  • Timezones: Loaded via EnumDynamicTimeZoneInformation—if supported. If not (e.g., Windows 7), we hardcode a fallback for UTC. You can still select timezones via the tray menu.
  • Registry Settings: Selected timezone and icon method are stored in HKEY_CURRENT_USER\Software\TrayClockApp.
  • Right-Click Menu: Scrollable menu shows all available timezones sorted by UTC offset. Submenu lets you switch between the redraw and three-icon methods, with visual checkmarks.

The Coding Adventure Unfolding: Evolution of the Dual Tray Clock

Chapter 1: The Humble Beginning

“In the beginning, there was just one icon…”

Like all good DIY-ers, we aimed simple:

  • One measly tray icon showing time and date
  • A nice dropdown menu to pick timezones (fancy!)
  • Updates every second like a good little clock should
  • Total lines of code: a respectable ~130 lines

The Developer’s Mood: “This is clean! This is elegant! I am a coding god!”

Chapter 2: The “Bigger is Better” Phase

“Wait, what if we had TWO icons?!”

When it become clear that there is no method to overcome the limitation of tray icon size for a user space app with no dependencies and not hooking into system-level components, obviously a brilliant idea appeared: “You know what? Let’s split this time!”

New Features:

  • Two icons now! Hours and minutes get their own real estate
  • Timer changed to update every minute (60000ms) — optimization!

The Developer’s Mood: “Look at this. Two icons! Revolutionary!”

What could go wrong: Well, everything, as we’ll see…

The “Oh No, Everything is Broken” Crisis

“Why are my icons in the wrong order?! PANIC!”

Reality hit hard. Turns out Windows has opinions about icon ordering, and we discovered this the hard way. Tray icons don’t always appear in the order you create them. Cue the coding equivalent of a nervous breakdown:

New “Features”:

  • Icon reordering detection system (because apparently Windows is rebellious)
  • iconsNeedReordering flag - the digital equivalent of a stress ball
  • CheckAndFixIconOrder() function - desperately trying to impose order on chaos
  • RecreateIconsInOrder() with dynamic IDs - "Maybe if I use different IDs, Windows will behave!"
  • Sleep delays everywhere — “Have you tried turning it off and on again?”
  • Font changed to Arial and made FW_BLACK — if you can’t fix the order, at least make it BOLD!

The Developer’s Mood: “I’ve created a monster. My simple clock now has more bug fixes than features. Why did I think this was a good idea?”

The detection logic trying to figure out if icons are swapped based on mouse events — it’s like trying to solve a murder mystery with a magnifying glass made of spaghetti.

The “Fine, I’ll Do It Right” Renaissance

“Three icons! Because if two is chaos, three must be… organized chaos?”

We, now a battle-hardened developer, a veteran of the Icon Wars, decided to go nuclear:

The Nuclear Option:

  • THREE icons: Clock symbol + Hours + Minutes (because why not?)
  • Redraw mode. Kill them all, before Windows hides them, and then bring back to life.
  • Full timezone support brought back from the dead
  • Registry integration — “I’ll remember your timezone choice, even if Windows forgets my icon order!”
  • Proper tooltip formatting with dates and UTC offsets
  • Sleep(100) delays scattered around like protective talismans

The Developer’s Mood: “Behold: the destroyer of system trays. But hey, at least it works… mostly.”

If Windows won’t cooperate with two icons, maybe three icons will confuse it into submission. It’s like debugging by increasing the chaos until it becomes organized.

The journey from 130 lines to 400+ lines is paved with Windows API frustrations

Compatibility: Windows 7, 10, 11

Modern software often waves goodbye to Windows 7 and pretends it never existed. Not here.

Dual clock in Windows 7 system tray

This app explicitly supports:

  • Windows 7: Despite lacking newer API calls, the app includes fallback logic and works without crashing or complaining.
  • Windows 10 & 11: Full support for modern DPI scaling, Unicode timezones, and dynamic timezone enumeration.
  • No DLL Hell: The app links statically and doesn’t rely on runtime redistributables. One ready to go file.

Compilation Instructions

The DualTimeClockTray app is publicly available for free on its GitHub repository page. Want to play with the source code and build it yourself?

With GCC (MinGW):

g++ main.cpp -static -static-libgcc -static-libstdc++ -mwindows -o DualTimeClockTray.exe

With MSVC (Visual Studio):

  • Create a new Win32 project.
  • Replace main.cpp with the provided source.
  • Build & run. No extra libraries or project settings needed.

You’ll get a single .exe file. Drop it into Windows Startup or run it manually. If it starts hidden for the first time drag it into visibility or relaunch. App runs silently, and does only it is intended to do — show a second clock in Windows system tray.

Core Restrictions of Windows System Tray Icons

Here are the most critical limitations developers face when working with tray icons in Windows:

Limited DPI Awareness: Icon Scaling and Clarity

Windows tray icons are bitmap-based, and DPI scaling is a notorious pain point:

  • LIM_SMALL maps to SM_CXSMICON (typically 16x16).
  • LIM_LARGE maps to SM_CXICON (typically 32x32).

If you only provide a 16x16 icon, Windows will stretch it on high-DPI displays (e.g. 150% scale → 24x24), causing blurriness.

Tray icons are rendered at device-independent pixels, so scaling mismatches are common unless handled explicitly.

No Native Support for Vector Icons or Fluent UI

Tray icons are strictly raster-based. Windows does not support SVG or Fluent UI icons in the tray. However that is the least concern when your icons draw only numbers. You can scale them easily.

Restricted Placement and Visibility

Tray icon visibility is user-controlled. Applications cannot force placement in the main tray. Default behavior:

  • Icons go to the overflow area unless the user drags them out manually.
  • No API exists to “pin” an icon permanently.

User interaction required:

  • Users must drag icons from overflow to tray.
  • Settings path: Settings > Personalization > Taskbar > Other System Tray Icons.

No programmatic override: even Shell_NotifyIcon with NIM_ADD or NIM_MODIFY cannot affect placement.

The Result: A Second Clock That Works

Here’s what you get:

  • Always-on second clock, without interfering with the original Windows clock.
  • Legible hours and minutes, not crammed into a single unreadable icon.
  • Dynamic timezone selection, with offset-sorted list and persistent storage.
  • No need for admin rights, third-party widgets, or Explorer hooks.
  • System-friendly and fully portable .exe.

No skinning engines. No themes. Just a dual clock that shows what you want, when you want it.

Final Thoughts

Every operating system tries to tell you what time it is. Very few succeed in showing you what time it is somewhere else — without friction.

DualTimeClockTray doesn’t pretend to be revolutionary. It’s a workaround. A patch. A product of necessity in a world where designers have ruined the luxury of modern screens. A simple task “just show me the time” still requires multiple clicks, two menus, and a prayer.

And in the end, the problem that seemed an easy DIY for an hour turns a massive headache requiring some workarounds for artificial limitations modern OSes impose on us. While all we wanted was to draw two numbers in the right lower corner of the screen.

Clone the repo. Compile the code. Run the app.
Your deserve to see your second time effortless.

💾 Download the Dual Time Clock for Windows 11 system tray.

Written by Eugen Barilyuk

0 followers

Meet Me, a tech enthusiast who occasionally forgets human languages, and firmly believes that bright mode is a way of life, not just a setting. github.com/Eb43

No responses yet

Eugen Barilyuk
Eugen Barilyuk

What are your thoughts?

" data-savepage-sameorigin="" height="1" width="1" style="position: absolute; top: 0px; left: 0px; border: medium; visibility: hidden;" data-savepage-key="0-0">
<--Visitor counter-->
https://www.free-counters.org Flag Counter