diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-12-23 15:30:07 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-12-23 15:30:07 +0000 |
commit | dfc984e97259bab3ab2de2f3b9cca0d9a097550d (patch) | |
tree | b9461d8acc5de1df006f6a8396b2a6dfb36e5d91 /protocols/FacebookRM/src/utils.cpp | |
parent | 2cd071fd8de860655b981d22ecac139cd6e4411b (diff) |
Facebook: Rework working with timestamps; version bump
Use time_t almost everywhere instead of DWORD and remove fix_timestamp method to replace it with to_timestamp
git-svn-id: http://svn.miranda-ng.org/main/trunk@11599 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/utils.cpp')
-rw-r--r-- | protocols/FacebookRM/src/utils.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index bceae044cf..3f1043728b 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -54,22 +54,19 @@ std::string utils::time::mili_timestamp() return timestamp.substr(0, 13);
}
-DWORD utils::time::fix_timestamp(unsigned __int64 mili_timestamp)
+time_t utils::time::from_string(const std::string &data)
{
- // If it is really mili_timestamp
- if (mili_timestamp > 100000000000)
- mili_timestamp /= 1000;
+ long long timestamp = _atoi64(data.c_str());
- return (DWORD)mili_timestamp;
-}
+ // If it is milli timestamp
+ if (timestamp > 100000000000)
+ timestamp /= 1000;
-DWORD utils::conversion::to_timestamp(const std::string &data)
-{
- DWORD timestamp = NULL;
- if (!utils::conversion::from_string<DWORD>(timestamp, data, std::dec)) {
- timestamp = static_cast<DWORD>(::time(NULL));
- }
- return timestamp;
+ // If conversion fails, use local time?
+ //if (!timestamp)
+ // timestamp = ::time(NULL);
+
+ return (time_t)timestamp;
}
std::string utils::conversion::to_string(void* data, WORD type)
|