summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-12-02 20:15:14 +0000
committerrandomdan <randomdan@localhost>2011-12-02 20:15:14 +0000
commit582bb65416a6c6a5e91c510adca1ce2fa356192f (patch)
tree95f8c047e8d5801cf335e52fbb7131bf6b160d14
parentAdd component events for process begin and before request (diff)
downloadproject2-582bb65416a6c6a5e91c510adca1ce2fa356192f.tar.bz2
project2-582bb65416a6c6a5e91c510adca1ce2fa356192f.tar.xz
project2-582bb65416a6c6a5e91c510adca1ce2fa356192f.zip
Send the expiry time to CouchDB when deleting old sessions (it's time seems oddly unreliable)
Address printf of int64_t at compile time
-rw-r--r--project2/common/fileStrmVarWriter.cpp5
-rw-r--r--project2/json/couchSession.cpp4
2 files changed, 6 insertions, 3 deletions
diff --git a/project2/common/fileStrmVarWriter.cpp b/project2/common/fileStrmVarWriter.cpp
index e5b3eae..0028af8 100644
--- a/project2/common/fileStrmVarWriter.cpp
+++ b/project2/common/fileStrmVarWriter.cpp
@@ -6,6 +6,9 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <stdio.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
FileStreamVariableWriter::FileStreamVariableWriter(FILE * o, bool q) :
out(o),
quoting(q)
@@ -23,7 +26,7 @@ void FileStreamVariableWriter::operator()(const Boolean & i) const {
fprintf(out, i.value ? "true" : "false");
}
void FileStreamVariableWriter::operator()(const int64_t & i) const {
- fprintf(out, "%ld", i);
+ fprintf(out, "%"PRId64, i);
}
void FileStreamVariableWriter::operator()(const double & i) const {
fprintf(out, "%g", i);
diff --git a/project2/json/couchSession.cpp b/project2/json/couchSession.cpp
index fd0d1b0..1f6c444 100644
--- a/project2/json/couchSession.cpp
+++ b/project2/json/couchSession.cpp
@@ -145,8 +145,8 @@ class CustomCouchSessionLoader : public SessionContainerLoaderImpl<CouchSessionC
// Create the server side search map
json::Object map;
Buffer mapBuf;
- mapBuf.appendf("function(doc) { var exp = doc['%s']; var now = (new Date().getTime() / 1000); if (exp < now) { emit(exp, doc._rev); } }",
- CouchSessionContainer::ExpiryKey.c_str());
+ mapBuf.appendf("function(doc) { var exp = doc['%s']; if (exp < %u) { emit(exp, doc._rev); } }",
+ CouchSessionContainer::ExpiryKey.c_str(), (unsigned int)time(NULL));
map["map"] = json::ValuePtr(new json::Value(mapBuf.str()));
Glib::ustring mapStr(json::serializeObject(map));
// Create the CURL handle