summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt/src/date_utils.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-12-22 09:03:06 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-12-22 09:03:06 +0000
commit64e9360e0dbf2cdeef7926e4d20e906895fd6bc3 (patch)
treebb28c64e5cc8e7ed3dfcc172d2d2036c18c4fc93 /plugins/WhenWasIt/src/date_utils.cpp
parent3d157994520f5d7c3b96e0079869038199cd0d39 (diff)
WhenWasIt: fix for birthday reminder when year not set (path by alitor)
git-svn-id: http://svn.miranda-ng.org/main/trunk@11574 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WhenWasIt/src/date_utils.cpp')
-rw-r--r--plugins/WhenWasIt/src/date_utils.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp
index c10fdfe56b..41ab186044 100644
--- a/plugins/WhenWasIt/src/date_utils.cpp
+++ b/plugins/WhenWasIt/src/date_utils.cpp
@@ -30,7 +30,7 @@ time_t Today()
bool IsDOBValid(int year, int month, int day)
{
- return (year != 0 && month != 0 && day != 0);
+ return (month != 0 && day != 0);
}
int GetContactDOB(MCONTACT hContact, int &year, int &month, int &day)
@@ -76,7 +76,10 @@ int GetContactAge(MCONTACT hContact)
time(&tNow);
struct tm *now = localtime(&tNow);
GetContactDOB(hContact, year, month, day);
- return (now->tm_year + 1900) - year;
+ if (year == 0)
+ return 0;
+ else
+ return (now->tm_year + 1900) - year;
}
char GetContactGender(MCONTACT hContact)