bin/werclib.rc: ndate -a is rfc3339; ndate -t is iso-8601

This commit is contained in:
stanley lieber 2019-12-09 22:19:18 -05:00
parent b34f460662
commit 0249712e67

View File

@ -146,219 +146,222 @@ fn ndate {
da=$date(3) da=$date(3)
} }
switch($date(5)){ switch($date(5)){
case A; tz=+01:00 case A; tz=+0100
case ADT; tz=-03:00 case ADT; tz=-0300
case AFT; tz=+430 case AFT; tz=+430
case AKDT; tz=-08:00 case AKDT; tz=-0800
case AKST; tz=-09:00 case AKST; tz=-0900
case ALMT; tz=+06:00 case ALMT; tz=+0600
case AMST; tz=-03:00 case AMST; tz=-0300
case AMT; tz=-04:00 case AMT; tz=-0400
case ANAST; tz=+12:00 case ANAST; tz=+1200
case ANAT; tz=+12:00 case ANAT; tz=+1200
case AQTT; tz=+05:00 case AQTT; tz=+0500
case ART; tz=-03:00 case ART; tz=-0300
case AST; tz=-04:00 case AST; tz=-0400
case AZOST; tz=+00:00 case AZOST; tz=+0000
case AZOT; tz=-01:00 case AZOT; tz=-0100
case AZST; tz=+05:00 case AZST; tz=+0500
case AZT; tz=+04:00 case AZT; tz=+0400
case B; tz=+02:00 case B; tz=+0200
case BNT; tz=+08:00 case BNT; tz=+0800
case BOT; tz=-04:00 case BOT; tz=-0400
case BRST; tz=-02:00 case BRST; tz=-0200
case BRT; tz=-03:00 case BRT; tz=-0300
case BST; tz=+01:00 case BST; tz=+0100
case BTT; tz=+06:00 case BTT; tz=+0600
case C; tz=+03:00 case C; tz=+0300
case CAST; tz=+08:00 case CAST; tz=+0800
case CAT; tz=+02:00 case CAT; tz=+0200
case CCT; tz=+0630 case CCT; tz=+0630
case CDT; tz=-05:00 case CDT; tz=-0500
case CEST; tz=+02:00 case CEST; tz=+0200
case CET; tz=+01:00 case CET; tz=+0100
case CHADT; tz=+1345 case CHADT; tz=+1345
case CHAST; tz=+1245 case CHAST; tz=+1245
case CKT; tz=-10:00 case CKT; tz=-1000
case CLST; tz=-03:00 case CLST; tz=-0300
case CLT; tz=-04:00 case CLT; tz=-0400
case COT; tz=-05:00 case COT; tz=-0500
case CST; tz=-06:00 case CST; tz=-0600
case CVT; tz=-01:00 case CVT; tz=-0100
case CXT; tz=+07:00 case CXT; tz=+0700
case ChST; tz=+10:00 case ChST; tz=+1000
case D; tz=+04:00 case D; tz=+0400
case DAVT; tz=+07:00 case DAVT; tz=+0700
case E; tz=+05:00 case E; tz=+0500
case EASST; tz=-05:00 case EASST; tz=-0500
case EAST; tz=-06:00 case EAST; tz=-0600
case EAT; tz=+03:00 case EAT; tz=+0300
case ECT; tz=-05:00 case ECT; tz=-0500
case EDT; tz=-04:00 case EDT; tz=-0400
case EEST; tz=+03:00 case EEST; tz=+0300
case EET; tz=+02:00 case EET; tz=+0200
case EGST; tz=+00:00 case EGST; tz=+0000
case EGT; tz=-01:00 case EGT; tz=-0100
case EST; tz=-05:00 case EST; tz=-0500
case ET; tz=-05:00 case ET; tz=-0500
case F; tz=+06:00 case F; tz=+0600
case FJST; tz=+13:00 case FJST; tz=+1300
case FJT; tz=+12:00 case FJT; tz=+1200
case FKST; tz=-03:00 case FKST; tz=-0300
case FKT; tz=-04:00 case FKT; tz=-0400
case FNT; tz=-02:00 case FNT; tz=-0200
case G; tz=+07:00 case G; tz=+0700
case GALT; tz=-06:00 case GALT; tz=-0600
case GAMT; tz=-09:00 case GAMT; tz=-0900
case GET; tz=+04:00 case GET; tz=+0400
case GFT; tz=-03:00 case GFT; tz=-0300
case GILT; tz=+12:00 case GILT; tz=+1200
case GMT; tz=+00:00 case GMT; tz=+0000
case GST; tz=+04:00 case GST; tz=+0400
case GYT; tz=-04:00 case GYT; tz=-0400
case H; tz=+08:00 case H; tz=+0800
case HAA; tz=-03:00 case HAA; tz=-0300
case HAC; tz=-05:00 case HAC; tz=-0500
case HADT; tz=-09:00 case HADT; tz=-0900
case HAE; tz=-04:00 case HAE; tz=-0400
case HAP; tz=-07:00 case HAP; tz=-0700
case HAR; tz=-06:00 case HAR; tz=-0600
case HAST; tz=-10:00 case HAST; tz=-1000
case HAT; tz=-0230 case HAT; tz=-0230
case HAY; tz=-08:00 case HAY; tz=-0800
case HKT; tz=+08:00 case HKT; tz=+0800
case HLV; tz=-0430 case HLV; tz=-0430
case HNA; tz=-04:00 case HNA; tz=-0400
case HNC; tz=-06:00 case HNC; tz=-0600
case HNE; tz=-05:00 case HNE; tz=-0500
case HNP; tz=-08:00 case HNP; tz=-0800
case HNR; tz=-07:00 case HNR; tz=-0700
case HNT; tz=-0330 case HNT; tz=-0330
case HNY; tz=-09:00 case HNY; tz=-0900
case HOVT; tz=+07:00 case HOVT; tz=+0700
case I; tz=+09:00 case I; tz=+0900
case ICT; tz=+07:00 case ICT; tz=+0700
case IDT; tz=+03:00 case IDT; tz=+0300
case IOT; tz=+06:00 case IOT; tz=+0600
case IRDT; tz=+0430 case IRDT; tz=+0430
case IRKST; tz=+09:00 case IRKST; tz=+0900
case IRKT; tz=+08:00 case IRKT; tz=+0800
case IRST; tz=+0330 case IRST; tz=+0330
case IST; tz=+02:00 case IST; tz=+0200
case JST; tz=+09:00 case JST; tz=+0900
case K; tz=+10:00 case K; tz=+1000
case KGT; tz=+06:00 case KGT; tz=+0600
case KRAST; tz=+08:00 case KRAST; tz=+0800
case KRAT; tz=+07:00 case KRAT; tz=+0700
case KST; tz=+09:00 case KST; tz=+0900
case KUYT; tz=+04:00 case KUYT; tz=+0400
case L; tz=+11:00 case L; tz=+1100
case LHDT; tz=+11:00 case LHDT; tz=+1100
case LHST; tz=+1030 case LHST; tz=+1030
case LINT; tz=+14:00 case LINT; tz=+1400
case M; tz=+12:00 case M; tz=+1200
case MAGST; tz=+12:00 case MAGST; tz=+1200
case MAGT; tz=+11:00 case MAGT; tz=+1100
case MART; tz=-0930 case MART; tz=-0930
case MAWT; tz=+05:00 case MAWT; tz=+0500
case MDT; tz=-06:00 case MDT; tz=-0600
case MHT; tz=+12:00 case MHT; tz=+1200
case MMT; tz=+0630 case MMT; tz=+0630
case MSD; tz=+04:00 case MSD; tz=+0400
case MSK; tz=+03:00 case MSK; tz=+0300
case MST; tz=-07:00 case MST; tz=-0700
case MUT; tz=+04:00 case MUT; tz=+0400
case MVT; tz=+05:00 case MVT; tz=+0500
case MYT; tz=+08:00 case MYT; tz=+0800
case N; tz=-01:00 case N; tz=-0100
case NCT; tz=+11:00 case NCT; tz=+1100
case NDT; tz=-0230 case NDT; tz=-0230
case NFT; tz=+1130 case NFT; tz=+1130
case NOVST; tz=+07:00 case NOVST; tz=+0700
case NOVT; tz=+06:00 case NOVT; tz=+0600
case NPT; tz=+0545 case NPT; tz=+0545
case NST; tz=-0330 case NST; tz=-0330
case NUT; tz=-11:00 case NUT; tz=-1100
case NZDT; tz=+13:00 case NZDT; tz=+1300
case NZST; tz=+12:00 case NZST; tz=+1200
case O; tz=-02:00 case O; tz=-0200
case OMSST; tz=+07:00 case OMSST; tz=+0700
case OMST; tz=+06:00 case OMST; tz=+0600
case P; tz=-03:00 case P; tz=-0300
case PDT; tz=-07:00 case PDT; tz=-0700
case PET; tz=-05:00 case PET; tz=-0500
case PETST; tz=+12:00 case PETST; tz=+1200
case PETT; tz=+12:00 case PETT; tz=+1200
case PGT; tz=+10:00 case PGT; tz=+1000
case PHOT; tz=+13:00 case PHOT; tz=+1300
case PHT; tz=+08:00 case PHT; tz=+0800
case PKT; tz=+05:00 case PKT; tz=+0500
case PMDT; tz=-02:00 case PMDT; tz=-0200
case PMST; tz=-03:00 case PMST; tz=-0300
case PONT; tz=+11:00 case PONT; tz=+1100
case PST; tz=-08:00 case PST; tz=-0800
case PT; tz=-08:00 case PT; tz=-0800
case PWT; tz=+09:00 case PWT; tz=+0900
case PYST; tz=-03:00 case PYST; tz=-0300
case PYT; tz=-04:00 case PYT; tz=-0400
case Q; tz=-04:00 case Q; tz=-0400
case R; tz=-05:00 case R; tz=-0500
case RET; tz=+04:00 case RET; tz=+0400
case S; tz=-06:00 case S; tz=-0600
case SAMT; tz=+04:00 case SAMT; tz=+0400
case SAST; tz=+02:00 case SAST; tz=+0200
case SBT; tz=+11:00 case SBT; tz=+1100
case SCT; tz=+04:00 case SCT; tz=+0400
case SGT; tz=+08:00 case SGT; tz=+0800
case SRT; tz=-03:00 case SRT; tz=-0300
case SST; tz=-11:00 case SST; tz=-1100
case T; tz=-07:00 case T; tz=-0700
case TAHT; tz=-10:00 case TAHT; tz=-1000
case TFT; tz=+05:00 case TFT; tz=+0500
case TJT; tz=+05:00 case TJT; tz=+0500
case TKT; tz=-10:00 case TKT; tz=-1000
case TLT; tz=+09:00 case TLT; tz=+0900
case TMT; tz=+05:00 case TMT; tz=+0500
case TVT; tz=+12:00 case TVT; tz=+1200
case U; tz=-08:00 case U; tz=-0800
case ULAT; tz=+08:00 case ULAT; tz=+0800
case UYST; tz=-02:00 case UYST; tz=-0200
case UYT; tz=-03:00 case UYT; tz=-0300
case UZT; tz=+05:00 case UZT; tz=+0500
case V; tz=-09:00 case V; tz=-0900
case VET; tz=-0430 case VET; tz=-0430
case VLAST; tz=+11:00 case VLAST; tz=+1100
case VLAT; tz=+10:00 case VLAT; tz=+1000
case VUT; tz=+11:00 case VUT; tz=+1100
case W; tz=-10:00 case W; tz=-1000
case WAST; tz=+02:00 case WAST; tz=+0200
case WAT; tz=+01:00 case WAT; tz=+0100
case WDT; tz=+09:00 case WDT; tz=+0900
case WEST; tz=+01:00 case WEST; tz=+0100
case WET; tz=+00:00 case WET; tz=+0000
case WFT; tz=+12:00 case WFT; tz=+1200
case WGST; tz=-02:00 case WGST; tz=-0200
case WGT; tz=-03:00 case WGT; tz=-0300
case WIB; tz=+07:00 case WIB; tz=+0700
case WIT; tz=+09:00 case WIT; tz=+0900
case WITA; tz=+08:00 case WITA; tz=+0800
case WST; tz=+08:00 case WST; tz=+0800
case WT; tz=+00:00 case WT; tz=+0000
case X; tz=-11:00 case X; tz=-1100
case Y; tz=-12:00 case Y; tz=-1200
case YAKST; tz=+10:00 case YAKST; tz=+1000
case YAKT; tz=+09:00 case YAKT; tz=+0900
case YAPT; tz=+10:00 case YAPT; tz=+1000
case YEKST; tz=+06:00 case YEKST; tz=+0600
case YEKT; tz=+05:00 case YEKT; tz=+0500
case Z; tz=+00:00 case Z; tz=+0000
} }
switch($1){ switch($1){
case -a # rfc3339
tz=`{echo $tz | sed 's/00$/:00/'}
echo $date(6)^-$mo-$da^T^$date(4)^$tz
case -i case -i
echo $date(6)^-$mo-$da echo $date(6)^-$mo-$da
case -m case -m # rfc2822
echo $date(1)^, $da $date(2) $date(6) $date(4) $tz echo $date(1)^, $da $date(2) $date(6) $date(4) $tz
case -t case -t # iso-8601
echo $date(6)^-$mo-$da^T^$date(4)^$tz echo $date(6)^-$mo-$da^T^$date(4)^$tz
} }
} }