Module: LiveJournal

Defined in:
lib/livejournal/basic.rb,
lib/livejournal.rb,
lib/livejournal/sync.rb,
lib/livejournal/entry.rb,
lib/livejournal/login.rb,
lib/livejournal/logjam.rb,
lib/livejournal/comment.rb,
lib/livejournal/friends.rb,
lib/livejournal/request.rb,
lib/livejournal/database.rb,
lib/livejournal/comments-xml.rb

Overview

Defined Under Namespace

Modules: LogJam, Request, Sync Classes: Comment, Database, Entry, Friend, Server, User

Constant Summary collapse

VERSION =
File.read(File.expand_path('../../VERSION',__FILE__)).chomp.freeze
DEFAULT_SERVER =
Server.new("LiveJournal.com", "http://www.livejournal.com")

Class Method Summary collapse

Class Method Details

.coerce_gmt(time) ⇒ Object

LiveJournal times have no time zone, as they are for display only: “I wrote this post at midnight”. However, it’s convenient to represent times with a Ruby time object. But when time zones get involved, everything gets confused; we’d like to store a Unix time in the database and those only make sense as GMT. To reduce confusion, then, we imagine all LiveJournal times are in GMT. This function takes a time in any time zone and just switches the timezone to GMT. That is, coerce_gmt of 11:12pm PST is 11:12 pm GMT. The entry time-setting functions require this GMT part to verify you’re thinking carefully about time when you use Entry#time. If I want an entry that has a time that corresponds to what I feel is “now”, I’d use

LiveJournal::coerce_gmt Time.now


40
41
42
43
44
45
# File 'lib/livejournal/entry.rb', line 40

def self.coerce_gmt time
  expanded = time.to_a
  expanded[8] = false  # dst flag
  expanded[9] = 'GMT'
  return Time.gm(*expanded)
end