summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-02-24 22:59:01 +0200
committerPaul Buetow <paul@buetow.org>2025-02-24 22:59:01 +0200
commit08e30830266c0996b85d3f28c25d09029011af94 (patch)
treeb5f6f048eb00a2725db68ebdd2d13708338dca14 /tools
parentdbce5567d660d8c1d396765990c3e77075c5e8ad (diff)
there is no bug in the time reporting all is fine
Diffstat (limited to 'tools')
-rw-r--r--tools/filewriter/main.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/filewriter/main.go b/tools/filewriter/main.go
new file mode 100644
index 0000000..25f5cb7
--- /dev/null
+++ b/tools/filewriter/main.go
@@ -0,0 +1,35 @@
+package main
+
+import (
+ "os"
+ "time"
+)
+
+func main() {
+ // Open the file in append mode, create it if it doesn't exist
+ file, err := os.OpenFile("output.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
+ if err != nil {
+ panic(err)
+ }
+ defer file.Close()
+
+ // Define the byte to be written
+ data := []byte("A") // Replace 'A' with any byte you wish to write
+
+ // Loop to write the byte every 3 seconds
+ for {
+ _, err := file.Write(data)
+ if err != nil {
+ panic(err)
+ }
+
+ // Flush writes to stable storage
+ err = file.Sync()
+ if err != nil {
+ panic(err)
+ }
+
+ // Wait for 3 seconds
+ time.Sleep(3 * time.Second)
+ }
+}