Changeset 9383 in ntrip for trunk/BNC/qwt/qwt_date.cpp
- Timestamp:
- Mar 19, 2021, 9:15:03 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_date.cpp
r8127 r9383 32 32 #endif 33 33 34 static QString qwtExpandedFormat( const QString & format, 34 static QString qwtExpandedFormat( const QString & format, 35 35 const QDateTime &dateTime, QwtDate::Week0Type week0Type ) 36 36 { … … 195 195 } 196 196 197 static inline void qwtFloorTime( 197 static inline void qwtFloorTime( 198 198 QwtDate::IntervalType intervalType, QDateTime &dt ) 199 199 { … … 224 224 dt.setTime( QTime( t.hour(), 0, 0 ) ); 225 225 break; 226 } 226 } 227 227 default: 228 228 break; … … 233 233 } 234 234 235 static inline QDateTime qwtToTimeSpec( 235 static inline QDateTime qwtToTimeSpec( 236 236 const QDateTime &dt, Qt::TimeSpec spec ) 237 237 { … … 255 255 } 256 256 257 #if 0 258 257 259 static inline double qwtToJulianDay( int year, int month, int day ) 258 260 { … … 280 282 if ( a < 0 ) 281 283 a -= b - 1; 282 284 283 285 return a / b; 284 } 286 } 287 288 #endif 285 289 286 290 static inline QDate qwtToDate( int year, int month = 1, int day = 1 ) … … 319 323 Translate from double to QDateTime 320 324 321 \param value Number of milliseconds since the epoch, 325 \param value Number of milliseconds since the epoch, 322 326 1970-01-01T00:00:00 UTC 323 327 \param timeSpec Time specification … … 373 377 374 378 const QTime time = dt.time(); 375 const double secs = 3600.0 * time.hour() + 379 const double secs = 3600.0 * time.hour() + 376 380 60.0 * time.minute() + time.second(); 377 381 … … 383 387 384 388 \param dateTime Datetime value 385 \param intervalType Interval type, how to ceil. 389 \param intervalType Interval type, how to ceil. 386 390 F.e. when intervalType = QwtDate::Months, the result 387 391 will be ceiled to the next beginning of a month … … 451 455 { 452 456 dt.setTime( QTime( 0, 0 ) ); 453 dt.setDate( qwtToDate( dateTime.date().year(), 457 dt.setDate( qwtToDate( dateTime.date().year(), 454 458 dateTime.date().month() ) ); 455 459 … … 484 488 485 489 \param dateTime Datetime value 486 \param intervalType Interval type, how to ceil. 490 \param intervalType Interval type, how to ceil. 487 491 F.e. when intervalType = QwtDate::Months, 488 the result will be ceiled to the next 492 the result will be ceiled to the next 489 493 beginning of a month 490 494 \return Floored datetime 491 495 \sa floor() 492 496 */ 493 QDateTime QwtDate::floor( const QDateTime &dateTime, 497 QDateTime QwtDate::floor( const QDateTime &dateTime, 494 498 IntervalType intervalType ) 495 499 { … … 533 537 dt.setTime( QTime( 0, 0 ) ); 534 538 535 const QDate date = qwtToDate( dt.date().year(), 539 const QDate date = qwtToDate( dt.date().year(), 536 540 dt.date().month() ); 537 541 dt.setDate( date ); … … 556 560 Minimum for the supported date range 557 561 558 The range of valid dates depends on how QDate stores the 562 The range of valid dates depends on how QDate stores the 559 563 Julian day internally. 560 564 … … 577 581 Maximum for the supported date range 578 582 579 The range of valid dates depends on how QDate stores the 583 The range of valid dates depends on how QDate stores the 580 584 Julian day internally. 581 585 … … 600 604 601 605 The first day of a week depends on the current locale 602 ( QLocale::firstDayOfWeek() ). 606 ( QLocale::firstDayOfWeek() ). 603 607 604 608 \param year Year … … 607 611 608 612 \sa QLocale::firstDayOfWeek(), weekNumber() 609 */ 613 */ 610 614 QDate QwtDate::dateOfWeek0( int year, Week0Type type ) 611 615 { … … 624 628 { 625 629 // according to ISO 8601 the first week is defined 626 // by the first thursday. 630 // by the first thursday. 627 631 628 632 int d = Qt::Thursday - firstDayOfWeek; … … 641 645 642 646 - QwtDate::FirstThursday\n 643 Corresponding to ISO 8601 ( see QDate::weekNumber() ). 647 Corresponding to ISO 8601 ( see QDate::weekNumber() ). 644 648 645 649 - QwtDate::FirstDay\n … … 737 741 week number with a leading zero ( 01 - 53 ) 738 742 739 As week 1 usually starts in the previous year a special rule 743 As week 1 usually starts in the previous year a special rule 740 744 is applied for formats, where the year is expected to match the 741 745 week number - even if the date belongs to the previous year.
Note:
See TracChangeset
for help on using the changeset viewer.