diff mbox

[v0,1/2] Print leading zeros after decimal point

Message ID 1425289405-13365-2-git-send-email-daniel.wagner@bmw-carit.de (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Wagner March 2, 2015, 9:43 a.m. UTC
The total time used for a test is a bit 'hard to read, because leading
zeros for the nsec part are missing, e.g.

      total.tv_sec = 1
      total.tv_nsec = 40013

results in

	1.40013

instead of

	1.000040013

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 flock01.c | 2 +-
 flock02.c | 2 +-
 lease01.c | 2 +-
 lease02.c | 2 +-
 posix01.c | 2 +-
 posix02.c | 2 +-
 posix03.c | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/flock01.c b/flock01.c
index f74e031..f5416f6 100644
--- a/flock01.c
+++ b/flock01.c
@@ -154,6 +154,6 @@  main(int argc, char **argv)
 		return 1;
 	}
 
-	printf("%ld.%ld\n", total.tv_sec, total.tv_nsec);
+	printf("%ld.%09ld\n", total.tv_sec, total.tv_nsec);
 	return 0;
 }
diff --git a/flock02.c b/flock02.c
index 9e795ac..81c770a 100644
--- a/flock02.c
+++ b/flock02.c
@@ -173,6 +173,6 @@  main(int argc, char **argv)
 		return 1;
 	}
 
-	printf("%ld.%ld\n", total.tv_sec, total.tv_nsec);
+	printf("%ld.%09ld\n", total.tv_sec, total.tv_nsec);
 	return 0;
 }
diff --git a/lease01.c b/lease01.c
index f3a2ae9..0771974 100644
--- a/lease01.c
+++ b/lease01.c
@@ -171,7 +171,7 @@  main(int argc, char **argv)
 		return 1;
 	}
 
-	printf("%ld.%ld\n", total.tv_sec, total.tv_nsec);
+	printf("%ld.%09ld\n", total.tv_sec, total.tv_nsec);
 
 	return 0;
 }
diff --git a/lease02.c b/lease02.c
index 0fa33e4..6450e16 100644
--- a/lease02.c
+++ b/lease02.c
@@ -173,6 +173,6 @@  main(int argc, char **argv)
 		return 1;
 	}
 
-	printf("%ld.%ld\n", total.tv_sec, total.tv_nsec);
+	printf("%ld.%09ld\n", total.tv_sec, total.tv_nsec);
 	return 0;
 }
diff --git a/posix01.c b/posix01.c
index 1dd853d..09f1de6 100644
--- a/posix01.c
+++ b/posix01.c
@@ -174,6 +174,6 @@  main(int argc, char **argv)
 		return 1;
 	}
 
-	printf("%ld.%ld\n", total.tv_sec, total.tv_nsec);
+	printf("%ld.%09ld\n", total.tv_sec, total.tv_nsec);
 	return 0;
 }
diff --git a/posix02.c b/posix02.c
index 8764db1..9a35c99 100644
--- a/posix02.c
+++ b/posix02.c
@@ -175,6 +175,6 @@  main(int argc, char **argv)
 		return 1;
 	}
 
-	printf("%ld.%ld\n", total.tv_sec, total.tv_nsec);
+	printf("%ld.%09ld\n", total.tv_sec, total.tv_nsec);
 	return 0;
 }
diff --git a/posix03.c b/posix03.c
index 291f21a..864f0f0 100644
--- a/posix03.c
+++ b/posix03.c
@@ -206,7 +206,7 @@  int main(int argc, char *argv[])
 		total = timespec_add(total, timespec_sub(end, start));
 	}
 
-	printf("%ld.%ld\n", total.tv_sec, total.tv_nsec);
+	printf("%ld.%09ld\n", total.tv_sec, total.tv_nsec);
 	kill_children();
 	return 0;
 }