summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-03-13 23:50:29 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-03-13 23:50:29 +0100
commit942157bde3687baefca3aea48c8773d37a52e527 (patch)
treecb86c17f85513a4a4174d6628802d0059edb47f4 /core
parentbe4d58e1203ae35dab97b14f08098f50998d4201 (diff)
parentfeef563f3f2ad7f1cb5aa2e788e3ea4adfee3c56 (diff)
Merge pull request #4027 from Razzlegames/fixMonthConsistency
Fixes the month consistency issue in enums (OS::Month) and get_date etc
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp7
-rw-r--r--core/bind/core_bind.h4
-rw-r--r--core/os/os.h4
3 files changed, 10 insertions, 5 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index bf611f89c9..915cbc0578 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -508,11 +508,11 @@ Dictionary _OS::get_time(bool utc) const {
}
/**
- * Get a dictionary of time values when given epoc time
+ * Get a dictionary of time values when given epoch time
*
* Dictionary Time values will be a union if values from #get_time
* and #get_date dictionaries (with the exception of dst =
- * day light standard time, as it cannot be determined from epoc)
+ * day light standard time, as it cannot be determined from epoch)
*/
Dictionary _OS::get_time_from_unix_time( uint64_t unix_time_val) const {
@@ -552,7 +552,8 @@ Dictionary _OS::get_time_from_unix_time( uint64_t unix_time_val) const {
imonth++;
}
- date.month = static_cast<OS::Month>(imonth);
+ /// Add 1 to month to make sure months are indexed starting at 1
+ date.month = static_cast<OS::Month>(imonth+1);
date.day = dayno + 1;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index ab11c4804c..db5ff42cfe 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -81,7 +81,9 @@ public:
};
enum Month {
- MONTH_JANUARY,
+ /// Start at 1 to follow Windows SYSTEMTIME structure
+ /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx
+ MONTH_JANUARY = 1,
MONTH_FEBRUARY,
MONTH_MARCH,
MONTH_APRIL,
diff --git a/core/os/os.h b/core/os/os.h
index 73726feb37..160c0495bb 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -224,7 +224,9 @@ public:
};
enum Month {
- MONTH_JANUARY,
+ /// Start at 1 to follow Windows SYSTEMTIME structure
+ /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx
+ MONTH_JANUARY = 1,
MONTH_FEBRUARY,
MONTH_MARCH,
MONTH_APRIL,