Permalink
Browse files

Make get_fuzzy_time accept a struct tm pointer

  • Loading branch information...
1 parent 3d5845c commit aac1fcb79a7fec5277abb0499fed72c87a87958f @caio committed Mar 27, 2012
Showing with 4 additions and 5 deletions.
  1. +1 −3 src/fuzzyclock.c
  2. +1 −1 src/fuzzyclock.h
  3. +2 −1 src/main.c
View
4 src/fuzzyclock.c
@@ -32,9 +32,7 @@ char* FUZZY_MSG[] = {
"five to %s\n",
};
-void get_fuzzy_time(time_t timer, char* buffer) {
- struct tm* clock = localtime(&timer);
-
+void get_fuzzy_time(struct tm* clock, char* buffer) {
int index = 0;
int hour = clock->tm_hour;
int min = clock->tm_min;
View
2 src/fuzzyclock.h
@@ -6,6 +6,6 @@
#define MAX_MSG_SIZE 30
-void get_fuzzy_time(time_t, char*);
+void get_fuzzy_time(struct tm*, char*);
#endif
View
3 src/main.c
@@ -5,7 +5,8 @@
int main(int argc, char const* argv[])
{
char msg[MAX_MSG_SIZE];
- get_fuzzy_time(time(NULL), msg);
+ time_t now = time(NULL);
+ get_fuzzy_time(localtime(&now), msg);
printf(msg);
return 0;
}

0 comments on commit aac1fcb

Please sign in to comment.