OSDN Git Service

I was library can be compiled 20140223
[zither/ds-zither.git] / libms / time_plas.c
1
2
3
4
5 // cha 単位で t 時 と mt 時間足したプラス時間を返す関数 24 + 1 = 1
6 int time_plas(int t, int pt, char cha)
7 {
8 int an, ans, plas;
9 an = 0;
10 ans = 0;
11 plas = 1;
12
13 switch(cha){
14    case 'h': plas = 23;
15              break;
16    case 'i': plas = 59;
17              break;
18    default : plas = 11;
19              break;
20    }
21
22 // 23 - 0
23 if(t == plas){
24    t = plas;
25    }
26 if(t > plas){
27    t = 0;
28    }
29 if(t <= 0){
30    t = 0;
31    }
32
33 // 23 - 0
34 if(pt == plas){
35    pt = plas;
36    }
37 if(pt > plas){
38    pt = 0;
39    }
40 if(pt <= 0){
41    pt = 0;
42    }
43
44 an = t + pt;
45 ans = an % plas; 
46
47
48 // printf("start = %d stop = %d plas = %d amari = %d\n", t, pt, an, ans);
49
50 return ans;
51 }
52
53
54
55
56