Changeset 122 for pjproject/trunk/pjlib/include/pj++/os.hpp
- Timestamp:
- Jan 18, 2006 11:32:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj++/os.hpp
r65 r122 21 21 22 22 #include <pj/os.h> 23 #include <pj/string.h> 23 24 #include <pj++/types.hpp> 24 25 #include <pj++/pool.hpp> … … 152 153 destroy(); 153 154 return Pj_Thread_API::create( pool, &thread_, &thread_proc, this, 154 flags, thread_name );155 flags, thread_name, stack_size); 155 156 } 156 157 … … 532 533 : sem_(NULL) 533 534 { 535 create(pool, max, initial, name); 534 536 } 535 537 … … 723 725 724 726 // 727 // Timestamp 728 // 729 class Pj_Timestamp 730 { 731 public: 732 pj_status_t get_timestamp() 733 { 734 return pj_get_timestamp(&ts_); 735 } 736 737 Pj_Timestamp& operator += (const Pj_Timestamp &rhs) 738 { 739 pj_add_timestamp(&ts_, &rhs.ts_); 740 return *this; 741 } 742 743 Pj_Timestamp& operator -= (const Pj_Timestamp &rhs) 744 { 745 pj_sub_timestamp(&ts_, &rhs.ts_); 746 return *this; 747 } 748 749 Pj_Time_Val to_time() const 750 { 751 Pj_Timestamp zero; 752 pj_memset(&zero, 0, sizeof(zero)); 753 return Pj_Time_Val(pj_elapsed_time(&zero.ts_, &ts_)); 754 } 755 756 pj_uint32_t to_msec() const 757 { 758 Pj_Timestamp zero; 759 pj_memset(&zero, 0, sizeof(zero)); 760 return pj_elapsed_msec(&zero.ts_, &ts_); 761 } 762 763 pj_uint32_t to_usec() const 764 { 765 Pj_Timestamp zero; 766 pj_memset(&zero, 0, sizeof(zero)); 767 return pj_elapsed_usec(&zero.ts_, &ts_); 768 } 769 770 pj_uint32_t to_nanosec() const 771 { 772 Pj_Timestamp zero; 773 pj_memset(&zero, 0, sizeof(zero)); 774 return pj_elapsed_nanosec(&zero.ts_, &ts_); 775 } 776 777 pj_uint32_t to_cycle() const 778 { 779 Pj_Timestamp zero; 780 pj_memset(&zero, 0, sizeof(zero)); 781 return pj_elapsed_cycle(&zero.ts_, &ts_); 782 } 783 784 private: 785 pj_timestamp ts_; 786 }; 787 788 789 // 725 790 // OS abstraction. 726 791 //
Note: See TracChangeset
for help on using the changeset viewer.