~ubuntu-branches/ubuntu/utopic/mongodb/utopic

« back to all changes in this revision

Viewing changes to .pc/0007-Use-TIME_UTC_-macro.patch/src/mongo/util/time_support.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-07-03 09:23:46 UTC
  • mfrom: (1.3.10) (44.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20140703092346-c5bvt46wnzougyly
Tags: 1:2.6.3-0ubuntu1
* New upstream stable release:
  - Dropped patches, included upstream:
    + 0003-All-platforms-but-Windows-find-hash-in-std-tr1.patch
    + 0008-Use-system-libstemmer.patch
    + 0011-Use-a-signed-char-to-store-BSONType-enumerations.patch
    + 0001-SERVER-12064-Atomic-operations-for-gcc-non-Intel-arc.patch
    + 0002-SERVER-12065-Support-ARM-and-AArch64-builds.patch
  - d/p/*: Refreshed/rebased remaining patches.
  - Use system provided libyaml-cpp:
    + d/control: Add libyaml-cpp-dev to BD's.
    + d/rules: Enable --with-system-yaml option.
    + d/p/fix-yaml-detection.patch: Fix detection of libyaml-cpp library.
  - d/mongodb-server.mongodb.upstart: Sync changes from upstream.
  - d/control,mongodb-dev.*: Drop mongodb-dev package; it has no reverse
    dependencies and upstream no longer install header files.
  - d/NEWS: Point users to upstream upgrade documentation for upgrades
    from 2.4 to 2.6.
* Merge from Debian unstable.
* d/control: BD on libv8-3.14-dev to ensure that transitioning to new v8
  versions is a explicit action due to changes in behaviour in >= 3.25
  (LP: #1295723).
* d/mongodb-server.prerm: Dropped debug echo call from maintainer script
  (LP: #1294455).

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <ctime>
21
21
#include <string>
22
22
#include <boost/thread/xtime.hpp>
23
 
#include <boost/date_time/posix_time/posix_time.hpp>
 
23
#include <boost/version.hpp>
24
24
 
25
 
#include "mongo/bson/util/misc.h"  // Date_t
 
25
#include "mongo/base/status_with.h"
 
26
#include "mongo/client/export_macros.h"
26
27
 
27
28
namespace mongo {
28
29
 
29
30
    void time_t_to_Struct(time_t t, struct tm * buf , bool local = false );
 
31
    std::string time_t_to_String(time_t t);
 
32
    std::string time_t_to_String_short(time_t t);
30
33
 
31
 
    /**
32
 
     * Gets the current time string (in fixed width) in UTC. Sample format:
33
 
     *
34
 
     * Wed Oct 31 13:34:47.996
35
 
     *
36
 
     * @param timeStr pointer to the buffer to set the string - should at least be
37
 
     *     24 bytes big.
38
 
     */
39
 
    void curTimeString(char* timeStr);
 
34
    struct Date_t {
 
35
        // TODO: make signed (and look for related TODO's)
 
36
        unsigned long long millis;
 
37
        Date_t(): millis(0) {}
 
38
        Date_t(unsigned long long m): millis(m) {}
 
39
        operator unsigned long long&() { return millis; }
 
40
        operator const unsigned long long&() const { return millis; }
 
41
        void toTm (tm *buf);
 
42
        std::string toString() const;
 
43
        time_t toTimeT() const;
 
44
        int64_t asInt64() const {
 
45
            return static_cast<int64_t>(millis);
 
46
        }
 
47
        bool isFormatable() const;
 
48
    };
40
49
 
41
50
    // uses ISO 8601 dates without trailing Z
42
51
    // colonsOk should be false when creating filenames
43
52
    std::string terseCurrentTime(bool colonsOk=true);
44
53
 
 
54
    /**
 
55
     * Formats "time" according to the ISO 8601 extended form standard, including date,
 
56
     * and time, in the UTC timezone.
 
57
     *
 
58
     * Sample format: "2013-07-23T18:42:14Z"
 
59
     */
45
60
    std::string timeToISOString(time_t time);
46
61
 
 
62
    /**
 
63
     * Formats "date" according to the ISO 8601 extended form standard, including date,
 
64
     * and time with milliseconds decimal component, in the UTC timezone.
 
65
     *
 
66
     * Sample format: "2013-07-23T18:42:14.072Z"
 
67
     */
 
68
    std::string dateToISOStringUTC(Date_t date);
 
69
 
 
70
    /**
 
71
     * Formats "date" according to the ISO 8601 extended form standard, including date,
 
72
     * and time with milliseconds decimal component, in the local timezone.
 
73
     *
 
74
     * Sample format: "2013-07-23T18:42:14.072-05:00"
 
75
     */
 
76
    std::string dateToISOStringLocal(Date_t date);
 
77
 
 
78
    /**
 
79
     * Formats "date" in fixed width in the local time zone.
 
80
     *
 
81
     * Sample format: "Wed Oct 31 13:34:47.996"
 
82
     */
 
83
    std::string dateToCtimeString(Date_t date);
 
84
 
 
85
    /**
 
86
     * Parses a Date_t from an ISO 8601 string representation.
 
87
     *
 
88
     * Sample formats: "2013-07-23T18:42:14.072-05:00"
 
89
     *                 "2013-07-23T18:42:14.072Z"
 
90
     *
 
91
     * Local times are currently not supported.
 
92
     */
 
93
    StatusWith<Date_t> dateFromISOString(const StringData& dateString);
 
94
 
47
95
    boost::gregorian::date currentDate();
48
96
 
49
97
    // parses time of day in "hh:mm" format assuming 'hh' is 00-23
50
98
    bool toPointInTime( const std::string& str , boost::posix_time::ptime* timeOfDay );
51
99
 
52
 
    void sleepsecs(int s);
53
 
    void sleepmillis(long long ms);
54
 
    void sleepmicros(long long micros);
 
100
    MONGO_CLIENT_API void sleepsecs(int s);
 
101
    MONGO_CLIENT_API void sleepmillis(long long ms);
 
102
    MONGO_CLIENT_API void sleepmicros(long long micros);
55
103
 
56
104
    class Backoff {
57
105
    public:
65
113
 
66
114
        void nextSleepMillis();
67
115
 
 
116
        /**
 
117
         * testing-only function. used in dbtests/basictests.cpp
 
118
         */
 
119
        int getNextSleepMillis(int lastSleepMillis, unsigned long long currTimeMillis,
 
120
                               unsigned long long lastErrorTimeMillis) const;
 
121
 
68
122
    private:
69
123
 
70
124
        // Parameters
103
157
#endif
104
158
 
105
159
}  // namespace mongo
 
160