Exemplo n.º 1
0
        public TimeIQ CreateTimeQuery()
        {
            TimeIQ iq = new TimeIQ(XmppGlobal.InternalClient.Document);

            iq.Type = jabber.protocol.client.IQType.get;
            return(iq);
        }
Exemplo n.º 2
0
        public void LoadEntityTime(jabber.JID jid)
        {
            TimeIQ iq = XmppGlobal.Queries.CreateTimeQuery();

            iq.To = jid;

            XmppGlobal.Queries.SendQuery(iq, new QueryCallback(GotTimeQuery), null);

            JidLabel.Text   = jid.ToString();
            Spinner.Visible = true;
        }
Exemplo n.º 3
0
        public void UTC()
        {
            XmlDocument doc = new XmlDocument();
            TimeIQ iq = new TimeIQ(doc);
            Time t = iq.Instruction;
            t.AddChild(doc.CreateElement("utc", t.NamespaceURI));
            Assert.AreEqual(DateTime.MinValue, t.UTC);
            DateTime start = DateTime.UtcNow;
            t.SetCurrentTime();

            // SetCurrentTime only stores seconds portion, whereas UtcNow has all
            // kinds of precision.  Are we within a second of being correct?
            TimeSpan ts = t.UTC - start;
            Assert.IsTrue(Math.Abs(ts.TotalSeconds) < 1.0);
        }
Exemplo n.º 4
0
        public void UTC()
        {
            XmlDocument doc = new XmlDocument();
            TimeIQ      iq  = new TimeIQ(doc);
            Time        t   = iq.Instruction;

            t.AddChild(doc.CreateElement("utc", t.NamespaceURI));
            Assert.AreEqual(DateTime.MinValue, t.UTC);
            DateTime start = DateTime.UtcNow;

            t.SetCurrentTime();

            // SetCurrentTime only stores seconds portion, whereas UtcNow has all
            // kinds of precision.  Are we within a second of being correct?
            TimeSpan ts = t.UTC - start;

            Assert.IsTrue(Math.Abs(ts.TotalSeconds) < 1.0);
        }
Exemplo n.º 5
0
 public TimeIQ CreateTimeQuery()
 {
     TimeIQ iq = new TimeIQ (XmppGlobal.InternalClient.Document);
     iq.Type = jabber.protocol.client.IQType.get;
     return iq;
 }