equal
deleted
inserted
replaced
|
1 /** |
|
2 * test/demos/min2time.c |
|
3 * Copyright (C) 2008 Markus Broeker |
|
4 */ |
|
5 |
|
6 #include <stdio.h> |
|
7 #include <stdlib.h> |
|
8 #include <string.h> |
|
9 #include <limits.h> |
|
10 |
|
11 int main (int argc, char **argv) |
|
12 { |
|
13 int minutes; |
|
14 |
|
15 if (argc == 2) |
|
16 minutes = atoi (argv[1]); |
|
17 else { |
|
18 printf ("Enter the amount of minutes: "); |
|
19 if (!scanf ("%d", &minutes)) |
|
20 return EXIT_FAILURE; |
|
21 } |
|
22 |
|
23 if ((minutes < 0) || !(minutes < INT_MAX)) |
|
24 return EXIT_FAILURE; |
|
25 |
|
26 printf ("%.3d:%.2d:%.2d:%.2d (yy:dd:hh:mm)\n", minutes / 60 / 24 / 365, (minutes / (60 * 24) % 365), |
|
27 (minutes / 60) % 24, minutes % 60); |
|
28 |
|
29 return EXIT_SUCCESS; |
|
30 } |