loggregator_messages 0.0.4.pre → 0.0.5.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,10 +11,8 @@ class LogMessage
|
|
11
11
|
SourceType::WARDEN_CONTAINER => 'App',}[source_type]
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
timestamp
|
16
|
-
t = timestamp.is_a?(Time) ? timestamp : Time.at(timestamp.to_f)
|
17
|
-
@timestamp = (t.tv_sec * 1000000000) + t.tv_nsec
|
14
|
+
def time=(time)
|
15
|
+
self.timestamp = (time.tv_sec * 1000000000) + time.tv_nsec
|
18
16
|
end
|
19
17
|
|
20
18
|
def time
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "loggregator_messages"
|
5
|
-
spec.version = '0.0.
|
5
|
+
spec.version = '0.0.5.pre'
|
6
6
|
spec.authors = ["Pivotal"]
|
7
7
|
spec.email = ["cf-eng@pivotallabs.com"]
|
8
8
|
spec.description = "Library for all of the protocol buffer messages."
|
@@ -87,46 +87,26 @@ describe LogMessage do
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
describe "#
|
91
|
-
it "defaults to Time.now" do
|
92
|
-
msg = LogMessage.new
|
93
|
-
|
94
|
-
expect(Time.at(msg.timestamp/1000000000.0)).to be_within(0.5).of(Time.now)
|
95
|
-
end
|
96
|
-
|
90
|
+
describe "#time=" do
|
97
91
|
it "takes a time object" do
|
98
92
|
msg = LogMessage.new
|
99
|
-
msg.
|
93
|
+
msg.time = Time.utc(2010, 1, 20, 19, 18, 17.654321011)
|
100
94
|
|
101
95
|
expect(msg.timestamp).to eq 1264015097654321011
|
102
96
|
end
|
103
|
-
|
104
|
-
it "takes a time in seconds since the epoch" do
|
105
|
-
msg = LogMessage.new
|
106
|
-
msg.timestamp = 1379087263
|
107
|
-
|
108
|
-
expect(msg.timestamp).to eq 1379087263000000000
|
109
|
-
end
|
110
|
-
|
111
|
-
it "takes a time in fractional seconds since the epoch" do
|
112
|
-
msg = LogMessage.new
|
113
|
-
msg.timestamp = 1379087263.654321
|
114
|
-
|
115
|
-
expect(msg.timestamp).to eq 1379087263654320955
|
116
|
-
end
|
117
97
|
end
|
118
98
|
|
119
99
|
describe "#time" do
|
120
100
|
it "returns a time object" do
|
121
101
|
msg = LogMessage.new
|
122
|
-
msg.timestamp =
|
102
|
+
msg.timestamp = 1264015097654321011
|
123
103
|
|
124
104
|
expect(msg.time).to be_a Time
|
125
105
|
end
|
126
106
|
|
127
107
|
it "returns a time object with nanosecond precision" do
|
128
108
|
msg = LogMessage.new
|
129
|
-
msg.timestamp =
|
109
|
+
msg.timestamp = 1264015097654321011
|
130
110
|
|
131
111
|
expect(msg.time.tv_nsec).to eq 654321011
|
132
112
|
end
|