use new PRACTICALLY_NEVER instead of hardcoding raw time value
All checks were successful
Build and Test / sonic-transformed (push) Successful in 3m26s
Build and Test / wii-u-chat (push) Successful in 3m26s
Build and Test / minecraft-wiiu (push) Successful in 3m33s
Build and Test / splatoon-testfire (push) Successful in 3m39s
Build and Test / splatoon (push) Successful in 3m47s
Build and Test / puyopuyo (push) Successful in 3m50s
Build and Test / friends (push) Successful in 3m57s
Build and Test / fast-racing-neo (push) Successful in 4m1s
Build and Test / mario-tennis (push) Successful in 4m1s
Build and Test / wii-sports-club (push) Successful in 4m1s
Build and Test / super-mario-maker (push) Successful in 4m28s
All checks were successful
Build and Test / sonic-transformed (push) Successful in 3m26s
Build and Test / wii-u-chat (push) Successful in 3m26s
Build and Test / minecraft-wiiu (push) Successful in 3m33s
Build and Test / splatoon-testfire (push) Successful in 3m39s
Build and Test / splatoon (push) Successful in 3m47s
Build and Test / puyopuyo (push) Successful in 3m50s
Build and Test / friends (push) Successful in 3m57s
Build and Test / fast-racing-neo (push) Successful in 4m1s
Build and Test / mario-tennis (push) Successful in 4m1s
Build and Test / wii-sports-club (push) Successful in 4m1s
Build and Test / super-mario-maker (push) Successful in 4m28s
This commit is contained in:
parent
7d81fe0259
commit
c687b09ab0
2 changed files with 40 additions and 29 deletions
|
|
@ -51,11 +51,9 @@ pub fn derive_key(pid: PID, password: &[u8]) -> [u8; 16] {
|
|||
pub struct KerberosDateTime(pub u64);
|
||||
|
||||
impl KerberosDateTime {
|
||||
#[deprecated]
|
||||
pub fn from_i64(val: i64) -> Self {
|
||||
Self(bytemuck::cast(val))
|
||||
}
|
||||
|
||||
// this is the time which smm returned as the expriy date, we use it as a
|
||||
// date so far into the future that it might as well just be never more generally
|
||||
pub const PRACTICALLY_NEVER: Self = Self::new(0, 0, 0, 31, 12, 9999);
|
||||
pub fn from_naive(dt: chrono::NaiveDateTime) -> Self {
|
||||
use chrono::Datelike;
|
||||
use chrono::Timelike;
|
||||
|
|
@ -93,7 +91,7 @@ impl KerberosDateTime {
|
|||
((self.0 >> 6) & 0b111111) as u8
|
||||
}
|
||||
pub const fn get_hours(&self) -> u8 {
|
||||
((self.0 >> 12) & 0b111111) as u8
|
||||
((self.0 >> 12) & 0b11111) as u8
|
||||
}
|
||||
pub const fn get_days(&self) -> u8 {
|
||||
((self.0 >> 17) & 0b111111) as u8
|
||||
|
|
@ -217,5 +215,20 @@ mod test {
|
|||
let time = KerberosDateTime(135904948834);
|
||||
|
||||
println!("{}", time.to_regular_time().to_rfc2822());
|
||||
|
||||
let time = KerberosDateTime(0x9C3F3E0000);
|
||||
|
||||
println!(
|
||||
"{}.{}.{} {}:{}:{}",
|
||||
time.get_year(),
|
||||
time.get_month(),
|
||||
time.get_days(),
|
||||
time.get_hours(),
|
||||
time.get_minutes(),
|
||||
time.get_seconds()
|
||||
);
|
||||
println!("{}", time.to_regular_time().to_rfc2822());
|
||||
|
||||
assert_eq!(KerberosDateTime::PRACTICALLY_NEVER, time)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ fn map_row_to_meta_info(
|
|||
refer_dat_id: row_refer_data_id as u32,
|
||||
flag: row_flag as u32,
|
||||
tags: row_tags,
|
||||
expire_time: KerberosDateTime::from_i64(0x9C3F3E0000),
|
||||
expire_time: KerberosDateTime::PRACTICALLY_NEVER,
|
||||
created_time: KerberosDateTime::from_naive(row_creation_date),
|
||||
updated_time: KerberosDateTime::from_naive(row_update_date),
|
||||
referred_time: KerberosDateTime::from_naive(row_creation_date),
|
||||
|
|
@ -1414,8 +1414,8 @@ impl DataStore for User {
|
|||
|
||||
async fn recommended_course_search_object(
|
||||
&self,
|
||||
course_search_param: DataStoreSearchParam,
|
||||
extra_data: Vec<String>,
|
||||
_course_search_param: DataStoreSearchParam,
|
||||
_extra_data: Vec<String>,
|
||||
) -> Result<Vec<DataStoreCustomRankingResult>, ErrorCode> {
|
||||
let mut courses = Vec::new();
|
||||
|
||||
|
|
@ -1439,14 +1439,20 @@ impl DataStore for User {
|
|||
object.creation_date,
|
||||
object.update_date,
|
||||
ranking.value
|
||||
FROM datastore.objects object
|
||||
JOIN datastore.object_custom_rankings ranking
|
||||
FROM (
|
||||
SELECT * FROM datastore.objects object
|
||||
WHERE
|
||||
object.upload_completed = TRUE AND
|
||||
object.deleted = FALSE AND
|
||||
object.under_review = FALSE
|
||||
) object
|
||||
JOIN (
|
||||
SELECT data_id, value
|
||||
FROM datastore.object_custom_rankings ranking
|
||||
WHERE ranking.application_id = 0
|
||||
) ranking
|
||||
ON
|
||||
object.data_id = ranking.data_id AND
|
||||
object.upload_completed = TRUE AND
|
||||
object.deleted = FALSE AND
|
||||
object.under_review = FALSE AND
|
||||
ranking.application_id = 0
|
||||
object.data_id = ranking.data_id
|
||||
ORDER BY RANDOM()
|
||||
LIMIT 100
|
||||
"#
|
||||
|
|
@ -1467,10 +1473,7 @@ impl DataStore for User {
|
|||
recipient_ids: row.delete_permission_recipients.unwrap_or_default(),
|
||||
};
|
||||
|
||||
let meta_binary = row
|
||||
.meta_binary
|
||||
.map(|bytes| QBuffer(bytes))
|
||||
.unwrap_or_default();
|
||||
let meta_binary = row.meta_binary.map(QBuffer).unwrap_or_default();
|
||||
|
||||
let created_time = row
|
||||
.creation_date
|
||||
|
|
@ -1502,18 +1505,13 @@ impl DataStore for User {
|
|||
refer_dat_id: row.refer_data_id.unwrap_or(0) as u32,
|
||||
flag: row.flag.unwrap_or(0) as u32,
|
||||
tags: row.tags.unwrap_or_default(),
|
||||
expire_time: KerberosDateTime::from_i64(0x9C3F3E0000),
|
||||
expire_time: KerberosDateTime::PRACTICALLY_NEVER,
|
||||
created_time,
|
||||
updated_time,
|
||||
referred_time,
|
||||
ratings: Vec::new(),
|
||||
ratings: get_rating_with_slot_data_id(row.data_id).await?,
|
||||
};
|
||||
|
||||
match get_rating_with_slot_data_id(row.data_id).await {
|
||||
Ok(ratings) => meta_info.ratings = ratings,
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
|
||||
let course = DataStoreCustomRankingResult {
|
||||
order: 0,
|
||||
score: row.value.unwrap_or(0) as u32,
|
||||
|
|
@ -1603,8 +1601,8 @@ impl DataStore for User {
|
|||
first_pid: row.first_pid as u32,
|
||||
best_pid: row.best_pid as u32,
|
||||
best_score: row.best_score,
|
||||
created_time: KerberosDateTime::from_i64(0x9C3F3E0000),
|
||||
updated_time: KerberosDateTime::from_i64(0x9C3F3E0000),
|
||||
created_time: KerberosDateTime::PRACTICALLY_NEVER,
|
||||
updated_time: KerberosDateTime::PRACTICALLY_NEVER,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue