Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract header and main.c

  • Loading branch information...
commit b4f814b29660003e4d30713de24f43a56eb343c7 1 parent fe842a7
@caio authored
Showing with 18 additions and 13 deletions.
  1. +2 −13 fuzzyclock.c
  2. +5 −0 fuzzyclock.h
  3. +11 −0 main.c
View
15 fuzzyclock.c
@@ -1,8 +1,6 @@
#include <stdio.h>
-#include <time.h>
#include <stdlib.h>
-
-#define BUFSIZE 30
+#include "fuzzyclock.h"
char* HOUR_NAMES[] = {
"one",
@@ -50,14 +48,5 @@ void get_fuzzy_time(time_t timer, char* buffer) {
char* timestr = FUZZY_MSG[index];
char* hourname = HOUR_NAMES[(hour - 1) % 12];
- snprintf(buffer, BUFSIZE, timestr, hourname);
-}
-
-
-int main(int argc, char const* argv[])
-{
- char msg[BUFSIZE];
- get_fuzzy_time(time(NULL), msg);
- printf(msg);
- return 0;
+ snprintf(buffer, MAX_MSG_SIZE, timestr, hourname);
}
View
5 fuzzyclock.h
@@ -0,0 +1,5 @@
+#include <time.h>
+
+#define MAX_MSG_SIZE 30
+
+void get_fuzzy_time(time_t, char*);
View
11 main.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include "fuzzyclock.h"
+
+
+int main(int argc, char const* argv[])
+{
+ char msg[MAX_MSG_SIZE];
+ get_fuzzy_time(time(NULL), msg);
+ printf(msg);
+ return 0;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.