ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/Publisher.cpp
(Generate patch)

Comparing trunk/Publisher.cpp (file contents):
Revision 30 by douglas, 2004-07-19T21:24:52-07:00 vs.
Revision 31 by douglas, 2004-07-20T00:11:56-07:00

# Line 22 | Line 22 | int Publisher::publish()
22  
23          // publish
24  
25 <        update();
25 >        while (true)
26 >        {
27 >                Stamp start, now;
28 >
29 >                update();
30 >
31 >                do
32 >                {
33 >                        sleep(Minute(1));
34 >
35 >                        now = Stamp();
36 >
37 >                        cerr << bright << magenta << ext::String(now) << white << '<'
38 >                                << cyan << ext::String(start + Hour(1)) << '\n' << reset;
39 >                }
40 >                while (now < start + Hour(1));
41 >        }
42   }
43  
44   void Publisher::update()
45   {
46 +        cerr << bright << yellow << "Publisher::update()\n" << reset;
47 +
48          Stamp stamp;
49          ext::Handle<dbi::Connection> db(dbi::Connect(database.driver, database.host,
50                  database.user, database.password, database.db));
51  
52 <        db->Execute("DELETE FROM messages WHERE stamp<'" + (stamp - 30) + "'");
52 >        db->Execute("DELETE FROM messages WHERE stamp<'" + (stamp - Day(30)) + "'");
53  
54          for (std::set<Buddy>::const_iterator buddy(buddies.begin()); buddy !=
55                  buddies.end(); ++buddy)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines