Skip to content

Commit

Permalink
fix(example-auth): convert UTC to local time
Browse files Browse the repository at this point in the history
Requires chrono 0.2.3 to work.
Also removed some warnings
  • Loading branch information
Byron committed Feb 27, 2015
1 parent 2b269e0 commit b23bb24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion examples/auth.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
extern crate "yup-oauth2" as oauth2;
extern crate "yup-hyper-mock" as mock;
extern crate hyper;
extern crate chrono;
extern crate getopts;

use chrono::{Local};
use getopts::{HasArg,Options,Occur,Fail};
use std::os;
use std::old_io::{File, FileMode, FileAccess};
Expand Down Expand Up @@ -53,7 +55,7 @@ fn main() {
given scopes. This is not a test !\n\
You have time until {} to do that.
Do not terminate the program until you deny or grant access !",
pi.user_code, pi.verification_url, pi.expires_at);
pi.user_code, pi.verification_url, pi.expires_at.with_timezone(&Local));
}
}

Expand All @@ -64,6 +66,7 @@ fn main() {
.retrieve_token(client, &client_id, &client_secret, &m.free) {
println!("Authentication granted !");
println!("You should store the following information for use, or revoke it.");
println!("All dates are given in UTC.");
println!("{:?}", t);
} else {
println!("Invalid client id, invalid scope, user denied access or request expired");
Expand Down
2 changes: 1 addition & 1 deletion src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use hyper;
use hyper::header::ContentType;
use url::form_urlencoded;
use itertools::Itertools;
use rustc_serialize::{self, json};
use rustc_serialize::json;
use chrono::{DateTime,UTC};

use common::{Token, AuthenticationType};
Expand Down
2 changes: 1 addition & 1 deletion src/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::Duration;
use chrono::UTC;
use hyper;
use hyper::header::ContentType;
use rustc_serialize::{self, json};
use rustc_serialize::json;
use url::form_urlencoded;
use super::Token;

Expand Down

0 comments on commit b23bb24

Please sign in to comment.