equal
deleted
inserted
replaced
351 |
351 |
352 "Created: / 1.7.1996 / 14:46:09 / cg" |
352 "Created: / 1.7.1996 / 14:46:09 / cg" |
353 "Modified: / 1.7.1996 / 15:22:07 / cg" |
353 "Modified: / 1.7.1996 / 15:22:07 / cg" |
354 "Modified: / 13.7.1999 / 12:30:26 / stefan" |
354 "Modified: / 13.7.1999 / 12:30:26 / stefan" |
355 ! ! |
355 ! ! |
|
356 |
356 |
357 |
357 !Timestamp class methodsFor:'private'! |
358 !Timestamp class methodsFor:'private'! |
358 |
359 |
359 basicReadFrom:aStream |
360 basicReadFrom:aStream |
360 "return a new Timestamp, reading a printed representation from aStream. |
361 "return a new Timestamp, reading a printed representation from aStream. |
1480 " |
1481 " |
1481 self utcOffsetFrom:'UTC' |
1482 self utcOffsetFrom:'UTC' |
1482 " |
1483 " |
1483 ! ! |
1484 ! ! |
1484 |
1485 |
|
1486 |
1485 !Timestamp methodsFor:'accessing'! |
1487 !Timestamp methodsFor:'accessing'! |
1486 |
1488 |
1487 day |
1489 day |
1488 "return the day-in-month of the receiver (1..31). |
1490 "return the day-in-month of the receiver (1..31). |
1489 For compatibility, use instances of Date for this." |
1491 For compatibility, use instances of Date for this." |
2354 " |
2356 " |
2355 Timestamp now utcSecondsSince1970 |
2357 Timestamp now utcSecondsSince1970 |
2356 " |
2358 " |
2357 ! ! |
2359 ! ! |
2358 |
2360 |
|
2361 |
|
2362 |
2359 !Timestamp methodsFor:'testing'! |
2363 !Timestamp methodsFor:'testing'! |
2360 |
2364 |
2361 isTimestamp |
2365 isTimestamp |
2362 ^ true |
2366 ^ true |
2363 ! |
2367 ! |
2433 |
2437 |
2434 "Created: / 15-06-2005 / 16:45:49 / masca" |
2438 "Created: / 15-06-2005 / 16:45:49 / masca" |
2435 "Modified: / 16-06-2005 / 15:04:45 / masca" |
2439 "Modified: / 16-06-2005 / 15:04:45 / masca" |
2436 ! |
2440 ! |
2437 |
2441 |
2438 dateFromDayNumber: anInteger |
2442 dateFromDayNumber: dayInYear |
2439 "Set month and day from an absolute number of the day in the year. 1.1. is day number one." |
2443 "Set month and day from an absolute number of the day in the year. 1.1. is day number one." |
2440 |
2444 |
2441 | leap | |
2445 |monthAndDay| |
2442 leap := self isLeapYear: year. |
2446 |
2443 |
2447 (dayInYear between: 1 and: 365) ifFalse: [ |
2444 (anInteger between: 1 and: 365) ifFalse: [ |
2448 (dayInYear = 366 and:[self leapYear: year]) |
2445 (leap and: [anInteger = 366]) |
2449 ifFalse: [self malformed: 'Bad day number: ' , dayInYear printString] |
2446 ifFalse: [self malformed: 'Bad day number: ' , anInteger printString] |
|
2447 ]. |
2450 ]. |
2448 |
2451 |
2449 self shouldImplement |
2452 monthAndDay := Date monthAndDayFromDayInYear:dayInYear forYear:year. |
|
2453 month := monthAndDay at:1. |
|
2454 day := monthAndDay at:2 |
2450 |
2455 |
2451 "Created: / 15-06-2005 / 11:27:35 / masca" |
2456 "Created: / 15-06-2005 / 11:27:35 / masca" |
2452 "Modified: / 16-06-2005 / 12:31:37 / masca" |
2457 "Modified: / 16-06-2005 / 12:31:37 / masca" |
2453 ! |
2458 ! |
2454 |
2459 |
2483 ! |
2488 ! |
2484 |
2489 |
2485 lastDayInMonth: anInteger |
2490 lastDayInMonth: anInteger |
2486 "Answer the number of the last day of the given month in the current year." |
2491 "Answer the number of the last day of the given month in the current year." |
2487 |
2492 |
2488 ^anInteger = 2 |
2493 ^ anInteger = 2 |
2489 ifTrue: [(self isLeapYear: year) ifTrue: [29] ifFalse: [28]] |
2494 ifTrue: [(self leapYear: year) ifTrue: [29] ifFalse: [28]] |
2490 ifFalse: [#(31 28 31 30 31 30 31 31 30 31 30 31) at: month] |
2495 ifFalse: [#(31 28 31 30 31 30 31 31 30 31 30 31) at: month] |
2491 |
2496 |
2492 "Created: / 15-06-2005 / 17:12:31 / masca" |
2497 "Created: / 15-06-2005 / 17:12:31 / masca" |
|
2498 ! |
|
2499 |
|
2500 leapYear: anInteger |
|
2501 ^ Date leapYear:anInteger. |
|
2502 |
|
2503 "Created: / 15-06-2005 / 16:16:31 / masca" |
2493 ! |
2504 ! |
2494 |
2505 |
2495 timestampWithClass:timestampClass |
2506 timestampWithClass:timestampClass |
2496 "Answer the timestamp as it has been parsed." |
2507 "Answer the timestamp as it has been parsed." |
2497 "Notes: |
2508 "Notes: |
3144 ! ! |
3155 ! ! |
3145 |
3156 |
3146 !Timestamp class methodsFor:'documentation'! |
3157 !Timestamp class methodsFor:'documentation'! |
3147 |
3158 |
3148 version |
3159 version |
3149 ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.154 2014-07-09 16:20:22 cg Exp $' |
3160 ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.155 2014-09-12 15:17:16 stefan Exp $' |
3150 ! |
3161 ! |
3151 |
3162 |
3152 version_CVS |
3163 version_CVS |
3153 ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.154 2014-07-09 16:20:22 cg Exp $' |
3164 ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.155 2014-09-12 15:17:16 stefan Exp $' |
3154 ! ! |
3165 ! ! |
3155 |
3166 |
3156 |
3167 |
3157 Timestamp initialize! |
3168 Timestamp initialize! |