commit
b4da0364f9
@ -18,13 +18,7 @@ import vec;
|
|||||||
import std::getopts;
|
import std::getopts;
|
||||||
import getopts::{optflag, optopt, opt_present};
|
import getopts::{optflag, optopt, opt_present};
|
||||||
|
|
||||||
enum _src {
|
|
||||||
/* Break cycles in package <-> source */
|
|
||||||
_source(source),
|
|
||||||
}
|
|
||||||
|
|
||||||
type package = {
|
type package = {
|
||||||
// source: _src,
|
|
||||||
name: str,
|
name: str,
|
||||||
uuid: str,
|
uuid: str,
|
||||||
url: str,
|
url: str,
|
||||||
@ -293,7 +287,6 @@ fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
vec::grow(src.packages, 1u, {
|
vec::grow(src.packages, 1u, {
|
||||||
// source: _source(src),
|
|
||||||
name: name,
|
name: name,
|
||||||
uuid: uuid,
|
uuid: uuid,
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -161,6 +161,24 @@ impl reader_util for reader {
|
|||||||
while !self.eof() { buf += self.read_bytes(2048u); }
|
while !self.eof() { buf += self.read_bytes(2048u); }
|
||||||
buf
|
buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn each_byte(it: fn(int) -> bool) {
|
||||||
|
while !self.eof() {
|
||||||
|
if !it(self.read_byte()) { break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn each_char(it: fn(char) -> bool) {
|
||||||
|
while !self.eof() {
|
||||||
|
if !it(self.read_char()) { break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn each_line(it: fn(str) -> bool) {
|
||||||
|
while !self.eof() {
|
||||||
|
if !it(self.read_line()) { break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reader implementations
|
// Reader implementations
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#[doc ="
|
#[doc ="
|
||||||
An implementation of the SHA-1 cryptographic hash.
|
An implementation of the SHA-1 cryptographic hash.
|
||||||
|
|
||||||
First create a `sha1` object using the `mk_sha1` constructor, then
|
First create a `sha1` object using the `sha1` constructor, then
|
||||||
feed it input using the `input` or `input_str` methods, which may be
|
feed it input using the `input` or `input_str` methods, which may be
|
||||||
called any number of times.
|
called any number of times.
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ export
|
|||||||
get_time,
|
get_time,
|
||||||
precise_time_ns,
|
precise_time_ns,
|
||||||
precise_time_s,
|
precise_time_s,
|
||||||
|
tzset,
|
||||||
tm,
|
tm,
|
||||||
empty_tm,
|
empty_tm,
|
||||||
now,
|
now,
|
||||||
@ -20,6 +21,7 @@ native mod rustrt {
|
|||||||
fn get_time(&sec: i64, &nsec: i32);
|
fn get_time(&sec: i64, &nsec: i32);
|
||||||
fn precise_time_ns(&ns: u64);
|
fn precise_time_ns(&ns: u64);
|
||||||
|
|
||||||
|
fn rust_tzset();
|
||||||
// FIXME: The i64 values can be passed by-val when #2064 is fixed.
|
// FIXME: The i64 values can be passed by-val when #2064 is fixed.
|
||||||
fn rust_gmtime(&&sec: i64, &&nsec: i32, &&result: tm);
|
fn rust_gmtime(&&sec: i64, &&nsec: i32, &&result: tm);
|
||||||
fn rust_localtime(&&sec: i64, &&nsec: i32, &&result: tm);
|
fn rust_localtime(&&sec: i64, &&nsec: i32, &&result: tm);
|
||||||
@ -59,6 +61,10 @@ fn precise_time_s() -> float {
|
|||||||
ret (precise_time_ns() as float) / 1000000000.;
|
ret (precise_time_ns() as float) / 1000000000.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn tzset() {
|
||||||
|
rustrt::rust_tzset();
|
||||||
|
}
|
||||||
|
|
||||||
type tm = {
|
type tm = {
|
||||||
tm_sec: i32, // seconds after the minute [0-60]
|
tm_sec: i32, // seconds after the minute [0-60]
|
||||||
tm_min: i32, // minutes after the hour [0-59]
|
tm_min: i32, // minutes after the hour [0-59]
|
||||||
@ -869,6 +875,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_at_utc() {
|
fn test_at_utc() {
|
||||||
os::setenv("TZ", "America/Los_Angeles");
|
os::setenv("TZ", "America/Los_Angeles");
|
||||||
|
tzset();
|
||||||
|
|
||||||
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
||||||
let utc = at_utc(time);
|
let utc = at_utc(time);
|
||||||
@ -890,10 +897,13 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_at() {
|
fn test_at() {
|
||||||
os::setenv("TZ", "America/Los_Angeles");
|
os::setenv("TZ", "America/Los_Angeles");
|
||||||
|
tzset();
|
||||||
|
|
||||||
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
||||||
let local = at(time);
|
let local = at(time);
|
||||||
|
|
||||||
|
#error("time_at: %?", local);
|
||||||
|
|
||||||
assert local.tm_sec == 30_i32;
|
assert local.tm_sec == 30_i32;
|
||||||
assert local.tm_min == 31_i32;
|
assert local.tm_min == 31_i32;
|
||||||
assert local.tm_hour == 15_i32;
|
assert local.tm_hour == 15_i32;
|
||||||
@ -916,6 +926,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_to_timespec() {
|
fn test_to_timespec() {
|
||||||
os::setenv("TZ", "America/Los_Angeles");
|
os::setenv("TZ", "America/Los_Angeles");
|
||||||
|
tzset();
|
||||||
|
|
||||||
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
||||||
let utc = at_utc(time);
|
let utc = at_utc(time);
|
||||||
@ -927,6 +938,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_conversions() {
|
fn test_conversions() {
|
||||||
os::setenv("TZ", "America/Los_Angeles");
|
os::setenv("TZ", "America/Los_Angeles");
|
||||||
|
tzset();
|
||||||
|
|
||||||
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
||||||
let utc = at_utc(time);
|
let utc = at_utc(time);
|
||||||
@ -943,6 +955,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_strptime() {
|
fn test_strptime() {
|
||||||
os::setenv("TZ", "America/Los_Angeles");
|
os::setenv("TZ", "America/Los_Angeles");
|
||||||
|
tzset();
|
||||||
|
|
||||||
alt strptime("", "") {
|
alt strptime("", "") {
|
||||||
ok(tm) {
|
ok(tm) {
|
||||||
@ -1088,11 +1101,14 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_ctime() {
|
fn test_ctime() {
|
||||||
os::setenv("TZ", "America/Los_Angeles");
|
os::setenv("TZ", "America/Los_Angeles");
|
||||||
|
tzset();
|
||||||
|
|
||||||
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
||||||
let utc = at_utc(time);
|
let utc = at_utc(time);
|
||||||
let local = at(time);
|
let local = at(time);
|
||||||
|
|
||||||
|
#error("test_ctime: %? %?", utc.ctime(), local.ctime());
|
||||||
|
|
||||||
assert utc.ctime() == "Fri Feb 13 23:31:30 2009";
|
assert utc.ctime() == "Fri Feb 13 23:31:30 2009";
|
||||||
assert local.ctime() == "Fri Feb 13 15:31:30 2009";
|
assert local.ctime() == "Fri Feb 13 15:31:30 2009";
|
||||||
}
|
}
|
||||||
@ -1100,6 +1116,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_strftime() {
|
fn test_strftime() {
|
||||||
os::setenv("TZ", "America/Los_Angeles");
|
os::setenv("TZ", "America/Los_Angeles");
|
||||||
|
tzset();
|
||||||
|
|
||||||
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
let time = { sec: 1234567890_i64, nsec: 54321_i32 };
|
||||||
let utc = at_utc(time);
|
let utc = at_utc(time);
|
||||||
|
@ -529,6 +529,11 @@ struct tm* LOCALTIME(const time_t *clock, tm *result) {
|
|||||||
#define TIMEGM(result) timegm(result)
|
#define TIMEGM(result) timegm(result)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern "C" CDECL void
|
||||||
|
rust_tzset() {
|
||||||
|
TZSET();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
rust_gmtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) {
|
rust_gmtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) {
|
||||||
tm tm;
|
tm tm;
|
||||||
@ -541,7 +546,6 @@ rust_gmtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) {
|
|||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
rust_localtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) {
|
rust_localtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) {
|
||||||
tm tm;
|
tm tm;
|
||||||
TZSET();
|
|
||||||
time_t s = *sec;
|
time_t s = *sec;
|
||||||
LOCALTIME(&s, &tm);
|
LOCALTIME(&s, &tm);
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ debug_abi_2
|
|||||||
get_port_id
|
get_port_id
|
||||||
get_task_id
|
get_task_id
|
||||||
get_time
|
get_time
|
||||||
|
rust_tzset
|
||||||
rust_gmtime
|
rust_gmtime
|
||||||
rust_localtime
|
rust_localtime
|
||||||
rust_timegm
|
rust_timegm
|
||||||
|
Loading…
Reference in New Issue
Block a user