<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -67,3 +67,5 @@ Rails::Initializer.run do |config|
   
   config.gem 'mislav-will_paginate', :version =&gt; '~&gt; 2.3.2', :lib =&gt; 'will_paginate', :source =&gt; 'http://gems.github.com'
 end
+
+ENV['TZ'] = 'UTC'
\ No newline at end of file</diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 ENV[&quot;RAILS_ENV&quot;] ||= 'production'
 
 FEED = 'http://www.mozes.com/_/rss?keyword_id=1031894'
+STAMPFILE = '/tmp/poll_mozes_tstamp'
 
 require &quot;#{RAILS_ROOT}/config/environment&quot;
 require 'hpricot'
@@ -21,7 +22,20 @@ def debug(msg)
   puts &quot;[poll_mozes] [debug] #{msg}&quot; if RAILS_ENV == 'development'
 end
 
+def write_tstamp(time = Time.now.utc)
+  file = File.new(STAMPFILE, &quot;w&quot;)
+  file.print time.to_s
+  file.close
+end
+
+def read_tstamp
+  stamps = []
+  stamps = IO.readlines(STAMPFILE) if File.exists? STAMPFILE
+  stamps[0].nil? ? (Time.now.utc - 1.hour) : Time.parse(stamps[0])
+end
+
 while($running) do
+  since = read_tstamp
   begin
   # DO NOT populate these fields for this dataset
     # report.uniqueid = nil                 (asterisk ONLY)
@@ -37,6 +51,13 @@ while($running) do
         item_id = (item/:guid).inner_text
         debug &quot;found item: #{item_id}&quot;
         
+        # only process items posted after our last check...
+        item_tstamp = Time.parse((item/:pubDate).inner_text)
+        if item_tstamp &lt; since
+          #debug &quot;skipping item #{item_id}, #{item_tstamp} before #{since}&quot;
+          next
+        end
+        
         # create a user if not already extant
         mozes_id = (item/'mozes:mozesUserId').inner_text.strip
         debug &quot;JIT user creation for #{mozes_id}&quot;
@@ -62,6 +83,7 @@ while($running) do
     puts &quot;[poll_mozes] Uncaught exception during loop: \n#{e.class}: #{e.message}\n\t#{e.backtrace.join(&quot;\n&quot;)} &quot;
     return
   end
+  write_tstamp
   sleep 10
 end
 </diff>
      <filename>lib/daemons/poll_mozes.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>46bdd245f810a0d60670efb86ca5eec28e117d5a</id>
    </parent>
  </parents>
  <author>
    <name>Billy Gray</name>
    <email>wgray@zetetic.net</email>
  </author>
  <url>http://github.com/davetroy/votereport/commit/8d22d90be079355a04723179d2485e1a38dfc340</url>
  <id>8d22d90be079355a04723179d2485e1a38dfc340</id>
  <committed-date>2008-10-24T13:53:58-07:00</committed-date>
  <authored-date>2008-10-24T13:53:58-07:00</authored-date>
  <message>- we are forcing all local time (Time.now) to UTC!
- support for last time checked, writes to tstamp file in case daemon is shut down
- could use some more testing, but appears to be working
- TODO: maybe switch this over to looper</message>
  <tree>498c63b6036a8d88a792c7f8318d9d68c457378a</tree>
  <committer>
    <name>Billy Gray</name>
    <email>wgray@zetetic.net</email>
  </committer>
</commit>
