summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-06-03 03:13:37 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-06-03 03:13:37 +0200
commit61eb83337daac43e6c048549c0300bdde7af158a (patch)
tree464628e339f43ddfce6a27fc1722e225e814cb01
parent39e513b0f0d03e0886ef2f201fc3d9e1e6186f8b (diff)
downloaddclock-master.tar
dclock-master.zip
Fixed some off-by-one bugsHEADmaster
-rw-r--r--.gitignore1
-rw-r--r--DDate.vala4
-rw-r--r--DDateTest.vala7
-rw-r--r--Makefile6
4 files changed, 15 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index fc5a6a3..f016f48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*~
DClock
+DDateTest
diff --git a/DDate.vala b/DDate.vala
index b29944d..7f9654d 100644
--- a/DDate.vala
+++ b/DDate.vala
@@ -66,14 +66,14 @@ public struct DDate {
}
public uchar get_day() {
- return (uchar)(get_day_of_year() % 73);
+ return (uchar)(((get_day_of_year()-1) % 73) + 1);
}
public DDateMonth get_month() {
if(is_st_tibs_day())
return DDateMonth.ST_TIBS_DAY;
- return (DDateMonth)(get_day_of_year()/73);
+ return (DDateMonth)((get_day_of_year()-1)/73);
}
public DDateWeekday get_weekday() {
diff --git a/DDateTest.vala b/DDateTest.vala
new file mode 100644
index 0000000..487aed7
--- /dev/null
+++ b/DDateTest.vala
@@ -0,0 +1,7 @@
+void main() {
+ Date date = Date();
+ date.set_dmy(15,3,2010);
+ DDate ddate = DDate(date);
+
+ print(ddate.to_string() + "\n");
+}
diff --git a/Makefile b/Makefile
index 0d4c1bc..1463447 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,11 @@
-all : DClock
+all : DClock DDateTest
DClock : DClock.vala DDate.vala
valac --pkg=libpanelapplet-2.0 DClock.vala DDate.vala
+DDateTest : DDateTest.vala DDate.vala
+ valac DDateTest.vala DDate.vala
+
+
clean :
rm -f DClock