Permalink
Browse files

Updated the RSS date format, as suggested by Daniel Kaminski.

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@922 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent b6717e7 commit 081c13565efed22f44905d1a5614bc2dde494d43 Tobbe Tornquist committed Oct 3, 2005
Showing with 33 additions and 22 deletions.
  1. +33 −22 src/yaws_rss.erl
View
@@ -384,28 +384,39 @@ to_xml([{Title, Link, Desc, Creator, GregSecs}|Tail]) ->
to_xml([]) ->
[].
-w3cdtf(GregSecs) ->
- Date = calendar:gregorian_seconds_to_datetime(GregSecs),
- {{Y,Mo,D},{H, Mi, S}} = Date,
- UDate = calendar:local_time_to_universal_time_dst(Date),
- [{{_,_,_},{UH,UMi,_}}] = UDate,
- {DifH,DifMi}={H-UH,Mi-UMi},
- if
- DifH>0 ->
- i2l(Y) ++ "-" ++ add_zero(i2l(Mo)) ++ "-" ++ add_zero(i2l(D)) ++
- "T" ++ add_zero(i2l(H)) ++ ":" ++ add_zero(i2l(Mi)) ++ ":" ++
- add_zero(i2l(S)) ++ "+" ++ add_zero(i2l(abs(DifH))) ++ ":" ++
- add_zero(i2l(abs(DifMi)));
- DifH<0 ->
- i2l(Y) ++ "-" ++ add_zero(i2l(Mo)) ++ "-" ++ add_zero(i2l(D)) ++
- "T" ++ add_zero(i2l(H)) ++ ":" ++ add_zero(i2l(Mi)) ++ ":" ++
- add_zero(i2l(S)) ++ "-" ++ add_zero(i2l(abs(DifH))) ++ ":" ++
- add_zero(i2l(abs(DifMi)));
- DifH==0 ->
- i2l(Y) ++ "-" ++ add_zero(i2l(Mo)) ++ "-" ++ add_zero(i2l(D)) ++
- "T" ++ add_zero(i2l(H)) ++ ":" ++ add_zero(i2l(Mi)) ++ ":" ++
- add_zero(i2l(S)) ++ "Z"
- end.
+
+w3cdtf(GregSecs)-> Date = calendar:gregorian_seconds_to_datetime(GregSecs),
+ {{Y,Mo,D},{H, Mi, S}} = Date,
+ [UDate|_] = calendar:local_time_to_universal_time_dst(Date),
+ {DiffD,{DiffH,DiffMi,_}}=calendar:time_difference(UDate,Date),
+ if
+ DiffH<12 ->
+ i2l(Y) ++ "-" ++ add_zero(i2l(Mo)) ++ "-"
+ ++ add_zero(i2l(D)) ++ "T" ++ add_zero(i2l(H)) ++
+ ":" ++ add_zero(i2l(Mi)) ++ ":"
+ ++ add_zero(i2l(S)) ++
+ "+" ++ add_zero(i2l(DiffH)) ++ ":"
+ ++ add_zero(i2l(DiffMi));
+ DiffH>12,DiffD==0 ->
+ i2l(Y) ++ "-" ++ add_zero(i2l(Mo)) ++ "-"
+ ++ add_zero(i2l(D)) ++ "T" ++ add_zero(i2l(H)) ++
+ ":" ++ add_zero(i2l(Mi)) ++ ":"
+ ++ add_zero(i2l(S)) ++
+ "+" ++ add_zero(i2l(DiffH)) ++ ":"
+ ++ add_zero(i2l(DiffMi));
+ DiffH>12,DiffD/=0 ->
+ i2l(Y) ++ "-" ++ add_zero(i2l(Mo)) ++ "-"
+ ++ add_zero(i2l(D)) ++ "T" ++ add_zero(i2l(H)) ++
+ ":" ++ add_zero(i2l(Mi)) ++ ":"
+ ++ add_zero(i2l(S)) ++
+ "-" ++ add_zero(i2l(24-DiffH)) ++ ":"
+ ++ add_zero(i2l(if DiffMi==0 -> DiffMi;DiffMi/=0 ->60-DiffMi end));
+ DiffH==0 ->
+ i2l(Y) ++ "-" ++ add_zero(i2l(Mo)) ++ "-"
+ ++ add_zero(i2l(D)) ++ "T" ++ add_zero(i2l(H)) ++
+ ":" ++ add_zero(i2l(Mi)) ++ ":"
+ ++ add_zero(i2l(S)) ++ "Z"
+ end.
add_zero([A]) -> [$0,A];
add_zero(L) -> L.

0 comments on commit 081c135

Please sign in to comment.