-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaff_date_heure.c
51 lines (45 loc) · 1.56 KB
/
aff_date_heure.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
** aff_date_heure.c for aff_date_heure in /home/charra_s/PSU_2014_my_ls
**
** Made by Sofiane Charrad
** Login <[email protected]>
**
** Started on Thu Nov 27 22:15:01 2014 Sofiane Charrad
** Last update Wed Dec 17 00:52:11 2014 Sofiane Charrad
*/
#include "my_ls.h"
void month(time_t const date_modif)
{
struct tm *infotime;
infotime = localtime(&date_modif);
(infotime->tm_mon+1 == 1) ? my_putstr(" janv. ") : my_putstr("");
(infotime->tm_mon+1 == 2) ? my_putstr(" févrb. ") : my_putstr("");
(infotime->tm_mon+1 == 3) ? my_putstr(" mars. ") : my_putstr("");
(infotime->tm_mon+1 == 4) ? my_putstr(" avril. ") : my_putstr("");
(infotime->tm_mon+1 == 5) ? my_putstr(" Mai. ") : my_putstr ("");
(infotime->tm_mon+1 == 6) ? my_putstr(" juin. ") : my_putstr ("");
(infotime->tm_mon+1 == 7) ? my_putstr(" juil. ") : my_putstr ("");
(infotime->tm_mon+1 == 8) ? my_putstr(" août. ") : my_putstr ("");
(infotime->tm_mon+1 == 9) ? my_putstr(" sept. ") : my_putstr("");
(infotime->tm_mon+1 == 10) ? my_putstr(" oct. ") : my_putstr("");
(infotime->tm_mon+1 == 11) ? my_putstr(" nov. ") : my_putstr("");
(infotime->tm_mon+1 == 12) ? my_putstr(" déc. ") : my_putstr("");
}
void aff_date_heure(time_t const date_modif)
{
struct tm *infotime;
infotime = localtime(&date_modif);
my_putstr(" ");
my_put_nbr(infotime->tm_mday);
my_putstr(" ");
my_put_nbr(infotime->tm_hour);
my_putstr(":");
if (infotime->tm_min < 10)
{
my_putstr("0");
my_put_nbr(infotime->tm_min);
}
else
my_put_nbr(infotime->tm_min);
my_putstr(" ");
}