Speed difference HFS and NTFS for data

76

It does not really matter. See here for more on the subject (though not a lot more).

Share:
76

Related videos on Youtube

oxigen
Author by

oxigen

Updated on September 18, 2022

Comments

  • oxigen
    oxigen over 1 year

    I need to get date for the first day of the week from any date. This code works fine, but for some dates I get a very strange result. A date from the first week of the year converts to last week's date:

    NSTimeInterval ti = 1420311299;
    NSDate* date = [NSDate dateWithTimeIntervalSince1970:ti];
    
    NSLog(@"%@", date); // OUTPUT: 2015-01-03 18:54:59 +0000
    
    NSCalendar* calendar = [NSCalendar currentCalendar];
    NSDateComponents *cmps = [calendar components:(kCFCalendarUnitWeekOfYear | kCFCalendarUnitYear) fromDate:date];
    
    cmps.weekday = calendar.firstWeekday;
    
    NSLog(@"%@", cmps); // OUTPUT:  Calendar Year: 2015
                        //          Week of Year: 1
                        //          Weekday: 1
    
    
    
    NSDate* newDate = [calendar dateFromComponents:cmps];
    
    NSLog(@"%@", newDate); // OUTPUT: 2015-12-26 22:00:00 +0000
    
    • soandos
      soandos almost 13 years
      Remove the second to last line unless you want the question to get closed.
  • oxigen
    oxigen almost 9 years
    Thanks. I'll try it. About 2-nd part. As you can see in my example, 3rd of January is a part of 53 week of CURRENT 2015 year. And I can't understand, how is it possible...
  • vikingosegundo
    vikingosegundo almost 9 years
    It sounds strange, but this is expected behavior. Even Apple steps into this issue twice: alarms not going off the first few days of a year.