summaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 111574c..3ca711d 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1 +1,41 @@
1#include "bu/util.h" 1#include "bu/util.h"
2
3int Bu::getDaysInMonth( int iMonth, int iYear )
4{
5 if( iMonth > 11 )
6 {
7 iYear += iMonth/12;
8 iMonth = iMonth%12;
9 }
10 switch( iMonth )
11 {
12 case 0:
13 case 2:
14 case 4:
15 case 6:
16 case 7:
17 case 9:
18 case 11:
19 return 31;
20 break;
21
22 case 3:
23 case 5:
24 case 8:
25 case 10:
26 return 30;
27 break;
28
29 case 1:
30 if( iYear%400 == 0 )
31 return 29;
32 if( iYear%100 == 0 )
33 return 28;
34 if( iYear%4 == 0 )
35 return 29;
36 return 28;
37 break;
38 }
39
40}
41