Changeset 2635
- Timestamp:
- 24/02/2010 20:12:00 (2 years ago)
- Location:
- box/trunk
- Files:
-
- 3 edited
-
bin/bbackupquery/BackupQueries.cpp (modified) (3 diffs)
-
lib/backupclient/BackupClientFileAttributes.cpp (modified) (1 diff)
-
lib/backupclient/BackupClientFileAttributes.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupquery/BackupQueries.cpp
r2625 r2635 436 436 } 437 437 438 static std::string GetTimeString(BackupStoreDirectory::Entry& en, 439 bool useLocalTime) 440 { 441 std::ostringstream out; 442 out << BoxTimeToISO8601String(en.GetModificationTime(), useLocalTime); 443 444 if(en.HasAttributes()) 445 { 446 const StreamableMemBlock &storeAttr(en.GetAttributes()); 447 BackupClientFileAttributes attr(storeAttr); 448 out << "~" << BoxTimeToISO8601String(attr.GetModificationTime(), 449 useLocalTime); 450 } 451 452 return out.str(); 453 } 438 454 439 455 // -------------------------------------------------------------------------- … … 535 551 { 536 552 // Show UTC times... 537 std::string time = BoxTimeToISO8601String( 538 en->GetModificationTime(), false); 539 printf("%s ", time.c_str()); 553 printf("%s ", GetTimeString(*en, false).c_str()); 540 554 } 541 555 … … 543 557 { 544 558 // Show local times... 545 std::string time = BoxTimeToISO8601String( 546 en->GetModificationTime(), true); 547 printf("%s ", time.c_str()); 559 printf("%s ", GetTimeString(*en, true).c_str()); 548 560 } 549 561 -
box/trunk/lib/backupclient/BackupClientFileAttributes.cpp
r2633 r2635 648 648 } 649 649 650 // -------------------------------------------------------------------------- 651 // 652 // Function 653 // Name: BackupClientFileAttributes::GetModificationTime() 654 // Purpose: Returns the modification time embedded in the 655 // attributes. 656 // Created: 2010/02/24 657 // 658 // -------------------------------------------------------------------------- 659 box_time_t BackupClientFileAttributes::GetModificationTime() const 660 { 661 // Got something loaded 662 if(GetSize() <= 0) 663 { 664 THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); 665 } 666 667 // Make sure there are clear attributes to use 668 EnsureClearAvailable(); 669 ASSERT(mpClearAttributes != 0); 670 671 // Check if the decrypted attributes are small enough, and the type of attributes stored 672 if(mpClearAttributes->GetSize() < (int)sizeof(int32_t)) 673 { 674 THROW_EXCEPTION(BackupStoreException, AttributesNotUnderstood); 675 } 676 int32_t *type = (int32_t*)mpClearAttributes->GetBuffer(); 677 ASSERT(type != 0); 678 if(ntohl(*type) != ATTRIBUTETYPE_GENERIC_UNIX) 679 { 680 // Don't know what to do with these 681 THROW_EXCEPTION(BackupStoreException, AttributesNotUnderstood); 682 } 683 684 // Check there is enough space for an attributes block 685 if(mpClearAttributes->GetSize() < (int)sizeof(attr_StreamFormat)) 686 { 687 // Too small 688 THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); 689 } 690 691 // Get pointer to structure 692 attr_StreamFormat *pattr = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); 693 694 return box_ntoh64(pattr->ModificationTime); 695 } 650 696 651 697 // -------------------------------------------------------------------------- -
box/trunk/lib/backupclient/BackupClientFileAttributes.h
r2460 r2635 48 48 void WriteAttributes(const char *Filename, 49 49 bool MakeUserWritable = false) const; 50 50 box_time_t GetModificationTime() const; 51 51 52 bool IsSymLink() const; 52 53
Note: See TracChangeset
for help on using the changeset viewer.
