From 20cd3a25655b08a508fb1642963c205f81f62394 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Fri, 28 Apr 2023 22:40:04 +0100
Subject: [PATCH] chore: made clock freq a separate func

---
 src/gb.rs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gb.rs b/src/gb.rs
index 3c98084a..ae412854 100644
--- a/src/gb.rs
+++ b/src/gb.rs
@@ -580,6 +580,10 @@ impl GameBoy {
         self.apu().set_clock_freq(value);
     }
 
+    pub fn clock_freq_s(&self) -> String {
+        format!("{:.02} Mhz", self.clock_freq() as f32 / 1000.0 / 1000.0)
+    }
+
     pub fn attach_null_serial(&mut self) {
         self.attach_serial(Box::<NullDevice>::default());
     }
@@ -610,13 +614,13 @@ impl GameBoy {
 
     pub fn description(&self, column_length: usize) -> String {
         format!(
-            "{}  {}\n{}  {}\n{}  {:.02} Mhz\n{}  {}\n{}  {}\n{}  {}",
+            "{}  {}\n{}  {}\n{}  {}\n{}  {}\n{}  {}\n{}  {}",
             format!("{:width$}", "Version", width = column_length),
             VERSION,
             format!("{:width$}", "Mode", width = column_length),
             self.mode(),
             format!("{:width$}", "Clock", width = column_length),
-            self.clock_freq() as f32 / 1000.0 / 1000.0,
+            self.clock_freq_s(),
             format!("{:width$}", "RAM Size", width = column_length),
             self.ram_size(),
             format!("{:width$}", "VRAM Size", width = column_length),
-- 
GitLab