public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* chere 1.4 bug(?) - "Bash Prompt Here" not shown under Libraries folders
@ 2015-10-21 12:25 cpengr
  2015-10-21 16:51 ` Achim Gratz
  0 siblings, 1 reply; 16+ messages in thread
From: cpengr @ 2015-10-21 12:25 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]

Under certain circumstances, when I right-click in the empty space in
Windows Explorer, in any folder or subfolder beneath any "Libraries"
folder (e.g. my "Documents"), the "Bash Prompt Here" option is not
shown in the context menu.

Option is *not shown* under these circumstances:

1. Browse to the folder/subfolder via the Libraries tree on the left
pane in Windows Explorer. (Including after drilling down via the right
side by double clicking.)

2. After #1, even if I copy the path from the explorer bar, and paste
it back in to the same, and press Enter.

However, the option *is* shown under the following circumstances:

3. Folders/subfolders not under Libraries.

4. Browse to the folder from the absolute path. (i.e. Via drive
letter, folder, subfolder...not via Libraries.)

5. Right-click on the folders/subfolders themselves (not on empty
space inside them), even if browing to them via Libraries.

6. Browse to folder under Libraries in Explorer via the Libraries
listed on the left. Copy the path from the location bar, paste it into
a *new explorer window*. Right click in the empty space within the
folder.

`which chere` tells me it's version 1.4. I'm running Cygwin x64 on
Win7 x64 w/ SP1. Redacted cygcheck.out attached.

cpengr

[-- Attachment #2: cygcheck.out --]
[-- Type: application/octet-stream, Size: 75085 bytes --]


Cygwin Configuration Diagnostics
Current System Time: Tue Oct 20 18:31:48 2015

Windows 7 Professional Ver 6.1 Build 7601 Service Pack 1

Path:	C:\cygwin64\home\myusername\dos2unix\bin
	C:\cygwin64\usr\local\bin
	C:\cygwin64\bin
	C:\Python27\Lib\site-packages\PyQt4
	C:\ProgramData\Oracle\Java\javapath
	C:\Windows\system32
	C:\Windows
	C:\Windows\System32\Wbem
	C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit
	C:\Program Files\Microsoft SQL Server\110\Tools\Binn
	C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0
	C:\Program Files\Microsoft SQL Server\120\Tools\Binn
	C:\Program Files\Intel\WiFi\bin
	C:\Program Files\Common Files\Intel\WirelessCommon
	C:\Program Files (x86)\Altium Designer S09 Viewer\System
	C:\Program Files\Microsoft\Web Platform Installer
	C:\Python27
	C:\Python27\Scripts
	C:\Windows\System32\WindowsPowerShell\v1.0
	C:\Windows\System32\WindowsPowerShell\v1.0
	C:\Program Files\doxygen\bin
	C:\Program Files\MiKTeX 2.9\miktex\bin\x64
	C:\Program Files (x86)\Git\cmd
	C:\Program Files (x86)\Git\bin
	C:\Program Files\TortoiseGit\bin
	C:\Program Files\TortoiseHg
	C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn
	C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio
	C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn
	C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn
	C:\Program Files\TortoiseSVN\bin
	C:\Program Files\GitTfs
	C:\Program Files\git-tf
	C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
	C:\cygwin64\lib\lapack

Output from C:\cygwin64\bin\id.exe
[redacted]

SysDir: C:\Windows\system32
WinDir: C:\Windows

USER = 'myusername'
PWD = '/home/myusername'
HOME = '/home/myusername'

HOMEPATH = '\Users\myusername'
APPDATA = 'C:\Users\myusername\AppData\Roaming'
ProgramW6432 = 'C:\Program Files'
HOSTNAME = '[redacted]'
SHELL = '/bin/bash'
TERM = 'xterm'
PROCESSOR_IDENTIFIER = 'Intel64 Family 6 Model 42 Stepping 7, GenuineIntel'
PROFILEREAD = 'true'
WINDIR = 'C:\Windows'
PUBLIC = 'C:\Users\Public'
OLDPWD = '/cygdrive/c/Windows/system32'
ORIGINAL_PATH = '/cygdrive/c/Python27/Lib/site-packages/PyQt4:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files (x86)/Microsoft SDKs/TypeScript/1.0:/cygdrive/c/Program Files/Microsoft SQL Server/120/Tools/Binn:/cygdrive/c/Program Files/Intel/WiFi/bin:/cygdrive/c/Program Files/Common Files/Intel/WirelessCommon:/cygdrive/c/Program Files (x86)/Altium Designer S09 Viewer/System:/cygdrive/c/Program Files/Microsoft/Web Platform Installer:/cygdrive/c/Python27:/cygdrive/c/Python27/Scripts:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/doxygen/bin:/cygdrive/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/cygdrive/c/Program Files (x86)/Git/cmd:/cygdrive/c/Program Files (x86)/Git/bin:/cygdrive/c/Program Files/TortoiseGit/bin:/cygdrive/c/Program Files/TortoiseHg:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/Client SDK/ODBC/110/Tools/Binn:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn/ManagementStudio:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/cygdrive/c/Program Files/TortoiseSVN/bin:/cygdrive/c/Program Files/GitTfs:/cygdrive/c/Program Files/git-tf:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE'
USERDOMAIN = '[redacted]'
CommonProgramFiles(x86) = 'C:\Program Files (x86)\Common Files'
OS = 'Windows_NT'
ALLUSERSPROFILE = 'C:\ProgramData'
windows_tracing_flags = '3'
windows_tracing_logfile = 'C:\BVTBin\Tests\installpackage\csilogfile.log'
GNUPLOT_LIB = 'C:\Program Files\gnuplot\demo;C:\Program Files\gnuplot\demo\games;C:\Program Files\gnuplot\share'
!:: = '::\'
TEMP = '/tmp'
COMMONPROGRAMFILES = 'C:\Program Files\Common Files'
GIT_SSH = 'C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe'
USERNAME = 'myusername'
CPPUTEST_HOME = 'C:\prog\WLS\SMRUnitTests\cpputest'
PROCESSOR_LEVEL = '6'
ProgramFiles(x86) = 'C:\Program Files (x86)'
PSModulePath = 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\'
FP_NO_HOST_CHECK = 'NO'
SYSTEMDRIVE = 'C:'
LANG = 'en_US.UTF-8'
VS120COMNTOOLS = 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\'
USERPROFILE = 'C:\Users\myusername'
TZ = '[redacted]'
PS1 = '\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
SVN_SSH = 'C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe'
LOGONSERVER = '\\SERV01'
CommonProgramW6432 = 'C:\Program Files\Common Files'
PROCESSOR_ARCHITECTURE = 'AMD64'
LOCALAPPDATA = 'C:\Users\myusername\AppData\Local'
ProgramData = 'C:\ProgramData'
EXECIGNORE = '*.dll'
SHLVL = '1'
USERDNSDOMAIN = '[redacted].LOCAL'
PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
HOMEDRIVE = 'C:'
COMSPEC = 'C:\Windows\system32\cmd.exe'
TMP = '/tmp'
SYSTEMROOT = 'C:\Windows'
PRINTER = '[redacted]'
PROCESSOR_REVISION = '2a07'
INFOPATH = '/usr/local/info:/usr/share/info:/usr/info'
PROGRAMFILES = 'C:\Program Files'
AltiumPath = 'C:\Program Files (x86)\Altium Designer S09 Viewer\System'
VS110COMNTOOLS = 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\'
NUMBER_OF_PROCESSORS = '8'
COMPUTERNAME = '[redacted]'
_ = '/usr/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygwin
HKEY_CURRENT_USER\Software\Cygwin\Installations
  (default) = '\??\C:\cygwin64'
HKEY_CURRENT_USER\Software\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\cygwin64_bash
  (default) = '&Bash Prompt Here'
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\cygwin64_bash\command
  (default) = 'C:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash.exe "%V"'
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cygwin64_bash
  (default) = '&Bash Prompt Here'
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cygwin64_bash\command
  (default) = 'C:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash.exe "%L"'
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\Background\Shell\cygwin64_bash
  (default) = '&Bash Prompt Here'
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\Background\Shell\cygwin64_bash\command
  (default) = 'C:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash.exe "%V"'
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cygwin64_bash
  (default) = '&Bash Prompt Here'
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cygwin64_bash\command
  (default) = 'C:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash.exe "%L"'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Installations
  (default) = '\??\C:\cygwin64'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\setup
  (default) = 'C:\cygwin64'
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\cygwin64_bash
  (default) = 'Cygwin Bash Prompt Here (x86_64)'
  UnInstallString = 'C:\cygwin64\bin\sh -c "PATH=/bin /bin/chere -u -s bash"'

obcaseinsensitive set to 1

Cygwin installations found in the registry:
  System: Key: e022582115c10879 Path: C:\cygwin64
  User:   Key: e022582115c10879 Path: C:\cygwin64

c:  hd  NTFS    470771Mb  74% CP CS UN PA FC     
d:  cd             N/A    N/A                    
e:  cd             N/A    N/A                    
n:  net NTFS     20480Mb  28% CP CS UN PA FC     DATA2
o:  net NTFS    953213Mb  72% CP CS UN PA FC     DATA2

C:\cygwin64      /          system  binary,auto
C:\cygwin64\bin  /usr/bin   system  binary,auto
C:\cygwin64\lib  /usr/lib   system  binary,auto
cygdrive prefix  /cygdrive  user    binary,posix=0,auto

Found: C:\cygwin64\bin\awk
Found: C:\Program Files (x86)\Git\bin\awk
Warning: C:\cygwin64\bin\awk hides C:\Program Files (x86)\Git\bin\awk
 -> C:\cygwin64\bin\gawk.exe
Found: C:\cygwin64\bin\bash.exe
Found: C:\Program Files (x86)\Git\bin\bash.exe
Warning: C:\cygwin64\bin\bash.exe hides C:\Program Files (x86)\Git\bin\bash.exe
Found: C:\cygwin64\bin\cat.exe
Found: C:\Program Files (x86)\Git\bin\cat.exe
Warning: C:\cygwin64\bin\cat.exe hides C:\Program Files (x86)\Git\bin\cat.exe
Found: C:\cygwin64\bin\cp.exe
Found: C:\Program Files (x86)\Git\bin\cp.exe
Warning: C:\cygwin64\bin\cp.exe hides C:\Program Files (x86)\Git\bin\cp.exe
Not Found: cpp (good!)
Not Found: crontab
Found: C:\cygwin64\bin\find.exe
Found: C:\Windows\system32\find.exe
Warning: C:\cygwin64\bin\find.exe hides C:\Windows\system32\find.exe
Found: C:\Program Files (x86)\Git\bin\find.exe
Warning: C:\cygwin64\bin\find.exe hides C:\Program Files (x86)\Git\bin\find.exe
Not Found: gcc
Not Found: gdb
Found: C:\cygwin64\bin\grep.exe
Found: C:\Program Files (x86)\Git\bin\grep.exe
Warning: C:\cygwin64\bin\grep.exe hides C:\Program Files (x86)\Git\bin\grep.exe
Found: C:\cygwin64\bin\kill.exe
Found: C:\Program Files (x86)\Git\bin\kill.exe
Warning: C:\cygwin64\bin\kill.exe hides C:\Program Files (x86)\Git\bin\kill.exe
Found: C:\cygwin64\bin\ld.exe
Found: C:\cygwin64\bin\ls.exe
Found: C:\Program Files (x86)\Git\bin\ls.exe
Warning: C:\cygwin64\bin\ls.exe hides C:\Program Files (x86)\Git\bin\ls.exe
Not Found: make
Found: C:\cygwin64\bin\mv.exe
Found: C:\Program Files (x86)\Git\bin\mv.exe
Warning: C:\cygwin64\bin\mv.exe hides C:\Program Files (x86)\Git\bin\mv.exe
Found: C:\Program Files (x86)\Git\bin\patch.exe
Found: C:\cygwin64\bin\perl.exe
Found: C:\Program Files (x86)\Git\bin\perl.exe
Warning: C:\cygwin64\bin\perl.exe hides C:\Program Files (x86)\Git\bin\perl.exe
Found: C:\cygwin64\bin\rm.exe
Found: C:\Program Files (x86)\Git\bin\rm.exe
Warning: C:\cygwin64\bin\rm.exe hides C:\Program Files (x86)\Git\bin\rm.exe
Found: C:\cygwin64\bin\sed.exe
Found: C:\Program Files (x86)\Git\bin\sed.exe
Warning: C:\cygwin64\bin\sed.exe hides C:\Program Files (x86)\Git\bin\sed.exe
Found: C:\cygwin64\bin\ssh.exe
Found: C:\Program Files (x86)\Git\bin\ssh.exe
Warning: C:\cygwin64\bin\ssh.exe hides C:\Program Files (x86)\Git\bin\ssh.exe
Found: C:\cygwin64\bin\sh.exe
Found: C:\Program Files (x86)\Git\bin\sh.exe
Warning: C:\cygwin64\bin\sh.exe hides C:\Program Files (x86)\Git\bin\sh.exe
Found: C:\cygwin64\bin\tar.exe
Found: C:\Program Files (x86)\Git\bin\tar.exe
Warning: C:\cygwin64\bin\tar.exe hides C:\Program Files (x86)\Git\bin\tar.exe
Found: C:\cygwin64\bin\test.exe
Found: C:\cygwin64\bin\vi.exe
Found: C:\Program Files (x86)\Git\bin\vi
Warning: C:\cygwin64\bin\vi.exe hides C:\Program Files (x86)\Git\bin\vi
Found: C:\cygwin64\bin\vim.exe
Found: C:\Program Files (x86)\Git\bin\vim
Warning: C:\cygwin64\bin\vim.exe hides C:\Program Files (x86)\Git\bin\vim

  154k 2015/05/23 C:\cygwin64\bin\cygapr-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygapr-1-0.dll" v0.0 ts=2015-05-23 02:30
  128k 2015/05/23 C:\cygwin64\bin\cygaprutil-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygaprutil-1-0.dll" v0.0 ts=2015-05-23 03:31
  578k 2015/06/01 C:\cygwin64\bin\cygarchive-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygarchive-13.dll" v0.0 ts=2015-06-01 22:04
   38k 2013/07/19 C:\cygwin64\bin\cygargp-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygargp-0.dll" v0.0 ts=2013-07-19 15:07
   16k 2013/03/26 C:\cygwin64\bin\cygattr-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygattr-1.dll" v0.0 ts=2013-03-26 18:26
  178k 2015/02/11 C:\cygwin64\bin\cygautotrace-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygautotrace-3.dll" v0.0 ts=2015-02-11 13:59
  180k 2015/03/23 C:\cygwin64\bin\cygblkid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygblkid-1.dll" v0.0 ts=2015-03-23 09:46
   64k 2013/03/07 C:\cygwin64\bin\cygbz2-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygbz2-1.dll" v0.0 ts=2013-03-07 02:54
 1086k 2015/08/23 C:\cygwin64\bin\cygcairo-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygcairo-2.dll" v0.0 ts=2015-08-23 18:50
   27k 2015/08/23 C:\cygwin64\bin\cygcairo-gobject-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygcairo-gobject-2.dll" v0.0 ts=2015-08-23 18:51
  119k 2015/08/23 C:\cygwin64\bin\cygcairo-script-interpreter-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygcairo-script-interpreter-2.dll" v0.0 ts=2015-08-23 18:51
   13k 2013/03/06 C:\cygwin64\bin\cygcatgets1.dll - os=4.0 img=0.0 sys=5.2
                  "cygcatgets1.dll" v0.0 ts=2013-03-06 14:34
   13k 2015/03/19 C:\cygwin64\bin\cygcom_err-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygcom_err-2.dll" v0.0 ts=2015-03-19 02:44
   31k 2013/04/24 C:\cygwin64\bin\cygcord-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygcord-1.dll" v0.0 ts=2013-04-24 23:14
  203k 2013/04/21 C:\cygwin64\bin\cygcroco-0.6-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygcroco-0.6-3.dll" v0.0 ts=2013-04-21 06:25
    9k 2013/03/07 C:\cygwin64\bin\cygcrypt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypt-0.dll" v0.0 ts=2013-03-07 09:29
 2217k 2015/07/09 C:\cygwin64\bin\cygcrypto-1.0.0.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypto-1.0.0.dll" v0.0 ts=2015-07-09 17:49
  428k 2015/10/07 C:\cygwin64\bin\cygcurl-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygcurl-4.dll" v0.0 ts=2015-10-07 22:52
   24k 2014/11/12 C:\cygwin64\bin\cygdatrie-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygdatrie-1.dll" v0.0 ts=2014-11-12 07:24
 1526k 2013/03/08 C:\cygwin64\bin\cygdb-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb-5.3.dll" v0.0 ts=2013-03-08 07:55
  111k 2013/03/08 C:\cygwin64\bin\cygdb_cxx-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb_cxx-5.3.dll" v0.0 ts=2013-03-08 07:56
  472k 2013/03/08 C:\cygwin64\bin\cygdb_sql-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb_sql-5.3.dll" v0.0 ts=2013-03-08 07:58
  169k 2014/02/10 C:\cygwin64\bin\cygdialog-11.dll - os=4.0 img=0.0 sys=5.2
                  "cygdialog-11.dll" v0.0 ts=2014-02-10 01:24
  173k 2015/03/13 C:\cygwin64\bin\cygdialog-12.dll - os=4.0 img=0.0 sys=5.2
                  "cygdialog-12.dll" v0.0 ts=2015-03-13 20:55
  154k 2013/10/20 C:\cygwin64\bin\cygedit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygedit-0.dll" v0.0 ts=2013-10-20 21:56
   91k 2015/10/14 C:\cygwin64\bin\cygEGL-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygEGL-1.dll" v0.0 ts=2015-10-14 07:40
  158k 2013/04/23 C:\cygwin64\bin\cygEMF-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygEMF-1.dll" v0.0 ts=2013-04-23 06:39
  147k 2013/07/31 C:\cygwin64\bin\cygexpat-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygexpat-1.dll" v0.0 ts=2013-07-31 22:53
   73k 2015/03/18 C:\cygwin64\bin\cygexslt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygexslt-0.dll" v0.0 ts=2015-03-19 00:39
   30k 2014/10/14 C:\cygwin64\bin\cygfam-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygfam-0.dll" v0.0 ts=2014-10-14 21:33
   26k 2015/01/11 C:\cygwin64\bin\cygffi-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygffi-6.dll" v0.0 ts=2015-01-11 09:25
 1067k 2015/07/31 C:\cygwin64\bin\cygfftw3-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygfftw3-3.dll" v0.0 ts=2015-07-31 21:05
 1025k 2015/07/31 C:\cygwin64\bin\cygfftw3f-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygfftw3f-3.dll" v0.0 ts=2015-07-31 20:50
   24k 2015/07/31 C:\cygwin64\bin\cygfftw3f_threads-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygfftw3f_threads-3.dll" v0.0 ts=2015-07-31 20:51
   24k 2015/07/31 C:\cygwin64\bin\cygfftw3_threads-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygfftw3_threads-3.dll" v0.0 ts=2015-07-31 21:05
  220k 2015/09/10 C:\cygwin64\bin\cygfontconfig-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygfontconfig-1.dll" v0.0 ts=2015-09-10 19:13
   57k 2015/06/09 C:\cygwin64\bin\cygformw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygformw-10.dll" v0.0 ts=2015-06-09 23:57
  545k 2015/01/15 C:\cygwin64\bin\cygfpx-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygfpx-1.dll" v0.0 ts=2015-01-15 12:50
  586k 2015/09/08 C:\cygwin64\bin\cygfreetype-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygfreetype-6.dll" v0.0 ts=2015-09-08 08:51
  103k 2013/04/24 C:\cygwin64\bin\cyggc-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggc-1.dll" v0.0 ts=2013-04-24 23:14
    8k 2013/04/24 C:\cygwin64\bin\cyggccpp-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggccpp-1.dll" v0.0 ts=2013-04-24 23:14
   69k 2015/07/02 C:\cygwin64\bin\cyggcc_s-seh-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggcc_s-seh-1.dll" v0.0 ts=2015-07-01 18:03
  475k 2015/03/18 C:\cygwin64\bin\cyggcrypt-11.dll - os=4.0 img=0.0 sys=5.2
                  "cyggcrypt-11.dll" v0.0 ts=2015-03-18 21:03
  579k 2015/03/18 C:\cygwin64\bin\cyggcrypt-20.dll - os=4.0 img=0.0 sys=5.2
                  "cyggcrypt-20.dll" v0.0 ts=2015-03-18 07:19
  221k 2015/01/23 C:\cygwin64\bin\cyggd-2.dll - os=4.0 img=0.0 sys=5.2
                  "cyggd-2.dll" v0.0 ts=2015-01-23 17:51
  364k 2015/02/09 C:\cygwin64\bin\cyggd-3.dll - os=4.0 img=0.0 sys=5.2
                  "cyggd-3.dll" v0.0 ts=2015-02-09 10:13
   40k 2014/05/27 C:\cygwin64\bin\cyggdbm-4.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdbm-4.dll" v0.0 ts=1970-01-01 00:00
   13k 2014/05/27 C:\cygwin64\bin\cyggdbm_compat-4.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdbm_compat-4.dll" v0.0 ts=1970-01-01 00:00
  119k 2015/09/01 C:\cygwin64\bin\cyggdk_pixbuf-2.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdk_pixbuf-2.0-0.dll" v0.0 ts=2015-09-01 17:34
  770k 2015/09/20 C:\cygwin64\bin\cyggettextlib-0-19-5-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggettextlib-0-19-5-1.dll" v0.0 ts=2015-09-20 19:15
  250k 2015/09/20 C:\cygwin64\bin\cyggettextsrc-0-19-5-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggettextsrc-0-19-5-1.dll" v0.0 ts=2015-09-20 19:20
 1142k 2015/07/02 C:\cygwin64\bin\cyggfortran-3.dll - os=4.0 img=0.0 sys=5.2
                  "cyggfortran-3.dll" v0.0 ts=2015-07-01 19:22
   32k 2013/07/22 C:\cygwin64\bin\cyggif-4.dll - os=4.0 img=0.0 sys=5.2
                  "cyggif-4.dll" v0.0 ts=2013-07-22 05:17
 1244k 2015/03/12 C:\cygwin64\bin\cyggio-2.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cyggio-2.0-0.dll" v0.0 ts=2015-03-12 06:25
  571k 2015/10/14 C:\cygwin64\bin\cygGL-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygGL-1.dll" v0.0 ts=2015-10-14 07:38
  283k 2015/10/14 C:\cygwin64\bin\cygglapi-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygglapi-0.dll" v0.0 ts=2015-10-14 07:11
  956k 2015/03/12 C:\cygwin64\bin\cygglib-2.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygglib-2.0-0.dll" v0.0 ts=2015-03-12 06:21
   14k 2015/03/12 C:\cygwin64\bin\cyggmodule-2.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cyggmodule-2.0-0.dll" v0.0 ts=2015-03-12 06:21
  520k 2015/01/26 C:\cygwin64\bin\cyggmp-10.dll - os=4.0 img=0.0 sys=5.2
                  "cyggmp-10.dll" v0.0 ts=2015-01-26 16:08
  281k 2015/03/12 C:\cygwin64\bin\cyggobject-2.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cyggobject-2.0-0.dll" v0.0 ts=2015-03-12 06:22
   73k 2015/07/02 C:\cygwin64\bin\cyggomp-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggomp-1.dll" v0.0 ts=2015-07-01 18:18
   62k 2015/03/19 C:\cygwin64\bin\cyggpg-error-0.dll - os=4.0 img=0.0 sys=5.2
                  "cyggpg-error-0.dll" v0.0 ts=2015-03-19 23:23
  116k 2013/08/05 C:\cygwin64\bin\cyggraphite2-3.dll - os=4.0 img=3.0 sys=5.2
                  "cyggraphite2-3.dll" v0.0 ts=2013-08-05 07:33
11338k 2015/02/12 C:\cygwin64\bin\cyggs-9.dll - os=4.0 img=0.0 sys=5.2
                  "cyggs-9.dll" v0.0 ts=2015-02-12 15:41
  255k 2015/06/02 C:\cygwin64\bin\cyggssapi_krb5-2.dll - os=4.0 img=0.0 sys=5.2
                  "cyggssapi_krb5-2.dll" v0.0 ts=2015-06-02 04:41
    9k 2015/03/12 C:\cygwin64\bin\cyggthread-2.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cyggthread-2.0-0.dll" v0.0 ts=2015-03-12 06:21
  691k 2013/04/22 C:\cygwin64\bin\cygguile-17.dll - os=4.0 img=0.0 sys=5.2
                  "cygguile-17.dll" v0.0 ts=2013-04-22 03:15
  373k 2015/10/13 C:\cygwin64\bin\cygharfbuzz-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygharfbuzz-0.dll" v0.0 ts=2015-10-13 17:26
   11k 2015/10/13 C:\cygwin64\bin\cygharfbuzz-icu-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygharfbuzz-icu-0.dll" v0.0 ts=2015-10-13 17:26
   30k 2015/01/27 C:\cygwin64\bin\cyghistory7.dll - os=4.0 img=0.0 sys=5.2
                  "cyghistory7.dll" v0.0 ts=2015-01-27 03:51
   77k 2014/08/10 C:\cygwin64\bin\cygICE-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygICE-6.dll" v0.0 ts=1970-01-01 00:00
  360k 2013/07/29 C:\cygwin64\bin\cygicons-0.dll - os=4.0 img=1.4 sys=5.2
                  "cygicons-0.dll" v0.0 ts=2013-07-29 02:27
 1009k 2015/02/20 C:\cygwin64\bin\cygiconv-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygiconv-2.dll" v0.0 ts=2015-02-20 17:07
21806k 2013/06/25 C:\cygwin64\bin\cygicudata51.dll - os=4.0 img=0.0 sys=5.2
                  "cygicudata51.dll" v0.0 ts=2013-06-25 06:30
24750k 2015/02/16 C:\cygwin64\bin\cygicudata54.dll - os=4.0 img=0.0 sys=5.2
                  "cygicudata54.dll" v0.0 ts=2015-02-16 19:08
25310k 2015/05/04 C:\cygwin64\bin\cygicudata55.dll - os=4.0 img=0.0 sys=5.2
                  "cygicudata55.dll" v0.0 ts=2015-05-04 17:06
24466k 2015/10/08 C:\cygwin64\bin\cygicudata56.dll - os=4.0 img=0.0 sys=5.2
                  "cygicudata56.dll" v0.0 ts=2015-10-08 13:46
 1717k 2013/06/25 C:\cygwin64\bin\cygicui18n51.dll - os=4.0 img=0.0 sys=5.2
                  "cygicui18n51.dll" v0.0 ts=2013-06-25 06:28
 1951k 2015/02/16 C:\cygwin64\bin\cygicui18n54.dll - os=4.0 img=0.0 sys=5.2
                  "cygicui18n54.dll" v0.0 ts=2015-02-16 19:06
 2005k 2015/05/04 C:\cygwin64\bin\cygicui18n55.dll - os=4.0 img=0.0 sys=5.2
                  "cygicui18n55.dll" v0.0 ts=2015-05-04 17:03
 2093k 2015/10/08 C:\cygwin64\bin\cygicui18n56.dll - os=4.0 img=0.0 sys=5.2
                  "cygicui18n56.dll" v0.0 ts=2015-10-08 13:42
   43k 2013/06/25 C:\cygwin64\bin\cygicuio51.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuio51.dll" v0.0 ts=2013-06-25 06:30
   44k 2015/02/16 C:\cygwin64\bin\cygicuio54.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuio54.dll" v0.0 ts=2015-02-16 19:07
   44k 2015/05/04 C:\cygwin64\bin\cygicuio55.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuio55.dll" v0.0 ts=2015-05-04 17:04
   44k 2015/10/08 C:\cygwin64\bin\cygicuio56.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuio56.dll" v0.0 ts=2015-10-08 13:44
  305k 2013/06/25 C:\cygwin64\bin\cygicule51.dll - os=4.0 img=0.0 sys=5.2
                  "cygicule51.dll" v0.0 ts=2013-06-25 06:28
  305k 2015/02/16 C:\cygwin64\bin\cygicule54.dll - os=4.0 img=0.0 sys=5.2
                  "cygicule54.dll" v0.0 ts=2015-02-16 19:06
  306k 2015/05/04 C:\cygwin64\bin\cygicule55.dll - os=4.0 img=0.0 sys=5.2
                  "cygicule55.dll" v0.0 ts=2015-05-04 17:04
  306k 2015/10/08 C:\cygwin64\bin\cygicule56.dll - os=4.0 img=0.0 sys=5.2
                  "cygicule56.dll" v0.0 ts=2015-10-08 13:44
   38k 2013/06/25 C:\cygwin64\bin\cygiculx51.dll - os=4.0 img=0.0 sys=5.2
                  "cygiculx51.dll" v0.0 ts=2013-06-25 06:28
   38k 2015/02/16 C:\cygwin64\bin\cygiculx54.dll - os=4.0 img=0.0 sys=5.2
                  "cygiculx54.dll" v0.0 ts=2015-02-16 19:06
   38k 2015/05/04 C:\cygwin64\bin\cygiculx55.dll - os=4.0 img=0.0 sys=5.2
                  "cygiculx55.dll" v0.0 ts=2015-05-04 17:04
   38k 2015/10/08 C:\cygwin64\bin\cygiculx56.dll - os=4.0 img=0.0 sys=5.2
                  "cygiculx56.dll" v0.0 ts=2015-10-08 13:44
 1231k 2013/06/25 C:\cygwin64\bin\cygicuuc51.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuuc51.dll" v0.0 ts=2013-06-25 06:27
 1311k 2015/02/16 C:\cygwin64\bin\cygicuuc54.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuuc54.dll" v0.0 ts=2015-02-16 19:05
 1326k 2015/05/04 C:\cygwin64\bin\cygicuuc55.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuuc55.dll" v0.0 ts=2015-05-04 17:03
 1348k 2015/10/08 C:\cygwin64\bin\cygicuuc56.dll - os=4.0 img=0.0 sys=5.2
                  "cygicuuc56.dll" v0.0 ts=2015-10-08 13:41
  196k 2014/12/06 C:\cygwin64\bin\cygidn-11.dll - os=4.0 img=0.0 sys=5.2
                  "cygidn-11.dll" v0.0 ts=2014-12-06 13:17
   40k 2015/09/20 C:\cygwin64\bin\cygintl-8.dll - os=4.0 img=0.0 sys=5.2
                  "cygintl-8.dll" v0.0 ts=2015-09-20 19:10
  294k 2013/09/09 C:\cygwin64\bin\cygiodbc-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygiodbc-2.dll" v0.0 ts=2013-09-09 16:36
   66k 2013/09/09 C:\cygwin64\bin\cygiodbcinst-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygiodbcinst-2.dll" v0.0 ts=2013-09-09 16:35
  272k 2015/01/23 C:\cygwin64\bin\cygjasper-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygjasper-1.dll" v0.0 ts=2015-01-23 18:01
   48k 2014/06/17 C:\cygwin64\bin\cygjbig-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygjbig-2.dll" v0.0 ts=1970-01-01 00:00
   18k 2014/06/17 C:\cygwin64\bin\cygjbig85-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygjbig85-2.dll" v0.0 ts=1970-01-01 00:00
  333k 2015/10/08 C:\cygwin64\bin\cygjpeg-8.dll - os=4.0 img=0.0 sys=5.2
                  "cygjpeg-8.dll" v0.0 ts=2015-10-08 08:35
  180k 2015/06/02 C:\cygwin64\bin\cygk5crypto-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygk5crypto-3.dll" v0.0 ts=2015-06-02 04:40
   85k 2015/10/08 C:\cygwin64\bin\cygkpathsea-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygkpathsea-6.dll" v0.0 ts=2015-10-08 20:10
  719k 2015/06/02 C:\cygwin64\bin\cygkrb5-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygkrb5-3.dll" v0.0 ts=2015-06-02 04:41
   35k 2015/06/02 C:\cygwin64\bin\cygkrb5support-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygkrb5support-0.dll" v0.0 ts=2015-06-02 04:40
   45k 2015/02/19 C:\cygwin64\bin\cyglber-2-4-2.dll - os=4.0 img=0.0 sys=5.2
                  "cyglber-2-4-2.dll" v0.0 ts=2015-02-19 14:39
  189k 2015/02/19 C:\cygwin64\bin\cyglcms-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyglcms-1.dll" v0.0 ts=2015-02-19 12:08
  293k 2014/11/14 C:\cygwin64\bin\cyglcms2-2.dll - os=4.0 img=0.0 sys=5.2
                  "cyglcms2-2.dll" v0.0 ts=2014-11-14 12:24
  246k 2015/02/19 C:\cygwin64\bin\cygldap-2-4-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygldap-2-4-2.dll" v0.0 ts=2015-02-19 14:40
  261k 2015/02/19 C:\cygwin64\bin\cygldap_r-2-4-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygldap_r-2-4-2.dll" v0.0 ts=2015-02-19 14:41
17466k 2015/02/08 C:\cygwin64\bin\cygLLVM-3.4.dll - os=4.0 img=0.0 sys=5.2
                  "cygLLVM-3.4.dll" v0.0 ts=2015-02-08 17:48
18545k 2015/05/26 C:\cygwin64\bin\cygLLVM-3.5.dll - os=4.0 img=0.0 sys=5.2
                  "cygLLVM-3.5.dll" v0.0 ts=2015-05-26 17:53
    6k 2015/08/20 C:\cygwin64\bin\cyglsa64.dll - os=4.0 img=0.0 sys=5.2
                  "cyglsa64.dll" v0.0 ts=2015-08-20 10:42
   35k 2015/10/20 C:\cygwin64\bin\cygltdl-7.dll - os=4.0 img=0.0 sys=5.2
                  "cygltdl-7.dll" v0.0 ts=2015-10-20 02:09
  139k 2015/05/03 C:\cygwin64\bin\cyglzma-5.dll - os=4.0 img=0.0 sys=5.2
                  "cyglzma-5.dll" v0.0 ts=2015-05-03 07:34
  126k 2014/11/17 C:\cygwin64\bin\cyglzo2-2.dll - os=4.0 img=0.0 sys=5.2
                  "cyglzo2-2.dll" v0.0 ts=2014-11-17 11:24
  114k 2015/08/12 C:\cygwin64\bin\cygmagic-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygmagic-1.dll" v0.0 ts=2015-08-12 20:01
  291k 2013/10/12 C:\cygwin64\bin\cygMagick++-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygMagick++-5.dll" v0.0 ts=2013-10-12 18:21
  346k 2015/02/11 C:\cygwin64\bin\cygMagick++-6.Q16-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygMagick++-6.Q16-5.dll" v0.0 ts=2015-02-10 23:24
 4157k 2013/10/12 C:\cygwin64\bin\cygMagickCore-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygMagickCore-5.dll" v0.0 ts=2013-10-12 18:17
 4443k 2015/07/01 C:\cygwin64\bin\cygMagickCore-6.Q16-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygMagickCore-6.Q16-2.dll" v0.0 ts=2015-07-01 23:02
 1088k 2013/10/12 C:\cygwin64\bin\cygMagickWand-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygMagickWand-5.dll" v0.0 ts=2013-10-12 18:19
 1143k 2015/07/01 C:\cygwin64\bin\cygMagickWand-6.Q16-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygMagickWand-6.Q16-2.dll" v0.0 ts=2015-07-01 23:03
  168k 2015/10/09 C:\cygwin64\bin\cygman-2-7-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygman-2-7-4.dll" v0.0 ts=2015-10-09 03:12
   22k 2015/10/09 C:\cygwin64\bin\cygmandb-2-7-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygmandb-2-7-4.dll" v0.0 ts=2015-10-09 03:18
   29k 2015/06/09 C:\cygwin64\bin\cygmenuw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygmenuw-10.dll" v0.0 ts=2015-06-09 23:57
  327k 2015/08/11 C:\cygwin64\bin\cygming-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygming-1.dll" v0.0 ts=2015-08-11 10:00
  341k 2015/06/30 C:\cygwin64\bin\cygmpfr-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygmpfr-4.dll" v0.0 ts=2015-06-30 18:39
  120k 2015/01/12 C:\cygwin64\bin\cygMrm-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygMrm-4.dll" v0.0 ts=2015-01-12 05:03
 2843k 2015/08/23 C:\cygwin64\bin\cygmysqlclient-18.dll - os=4.0 img=18.0 sys=5.2
                  "cygmysqlclient-18.dll" v0.0 ts=2015-08-23 21:29
   53k 2015/06/09 C:\cygwin64\bin\cygncurses++w-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygncurses++w-10.dll" v0.0 ts=2015-06-10 00:01
  301k 2015/06/09 C:\cygwin64\bin\cygncursesw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygncursesw-10.dll" v0.0 ts=2015-06-09 23:56
  131k 2014/11/14 C:\cygwin64\bin\cygneon-27.dll - os=4.0 img=0.0 sys=5.2
                  "cygneon-27.dll" v0.0 ts=2014-11-14 13:02
  193k 2015/08/26 C:\cygwin64\bin\cygnetpbm-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygnetpbm-10.dll" v0.0 ts=2015-08-26 05:12
  185k 2015/02/12 C:\cygwin64\bin\cygnettle-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygnettle-4.dll" v0.0 ts=2015-02-12 17:27
  126k 2015/01/12 C:\cygwin64\bin\cygopenjpeg-1.dll - os=4.0 img=1.5 sys=5.2
                  "cygopenjpeg-1.dll" v0.0 ts=2015-01-12 02:51
   30k 2015/01/13 C:\cygwin64\bin\cygOpenVG-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygOpenVG-1.dll" v0.0 ts=2015-01-13 09:53
  105k 2014/11/11 C:\cygwin64\bin\cygopts-25.dll - os=4.0 img=0.0 sys=5.2
                  "cygopts-25.dll" v0.0 ts=2014-11-11 22:02
  319k 2015/06/01 C:\cygwin64\bin\cygp11-kit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygp11-kit-0.dll" v0.0 ts=2015-06-01 19:02
   14k 2015/06/09 C:\cygwin64\bin\cygpanelw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygpanelw-10.dll" v0.0 ts=2015-06-09 23:56
  258k 2015/01/12 C:\cygwin64\bin\cygpango-1.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpango-1.0-0.dll" v0.0 ts=2015-01-12 02:40
   42k 2015/01/12 C:\cygwin64\bin\cygpangocairo-1.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpangocairo-1.0-0.dll" v0.0 ts=2015-01-12 02:41
   70k 2015/01/12 C:\cygwin64\bin\cygpangoft2-1.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpangoft2-1.0-0.dll" v0.0 ts=2015-01-12 02:40
   28k 2015/01/12 C:\cygwin64\bin\cygpangoxft-1.0-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpangoxft-1.0-0.dll" v0.0 ts=2015-01-12 02:40
   11k 2013/07/23 C:\cygwin64\bin\cygpaper-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpaper-1.dll" v0.0 ts=2013-07-23 05:40
  460k 2015/08/11 C:\cygwin64\bin\cygpcre-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpcre-1.dll" v0.0 ts=2015-08-11 18:19
 2033k 2015/07/12 C:\cygwin64\bin\cygperl5_22.dll - os=4.0 img=0.0 sys=5.2
                  "cygperl5_22.dll" v0.0 ts=2015-07-12 17:24
   39k 2015/04/09 C:\cygwin64\bin\cygpipeline-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpipeline-1.dll" v0.0 ts=2015-04-09 21:04
  654k 2014/11/16 C:\cygwin64\bin\cygpixman-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpixman-1-0.dll" v0.0 ts=2014-11-16 22:16
 1002k 2015/02/11 C:\cygwin64\bin\cygplotter-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygplotter-2.dll" v0.0 ts=2015-02-11 21:22
  149k 2015/04/13 C:\cygwin64\bin\cygpng15-15.dll - os=4.0 img=0.0 sys=5.2
                  "cygpng15-15.dll" v0.0 ts=2015-04-13 19:37
  175k 2015/10/15 C:\cygwin64\bin\cygpng16-16.dll - os=4.0 img=0.0 sys=5.2
                  "cygpng16-16.dll" v0.0 ts=2015-10-15 02:41
 1897k 2014/02/23 C:\cygwin64\bin\cygpoppler-44.dll - os=4.0 img=0.0 sys=5.2
                  "cygpoppler-44.dll" v0.0 ts=2014-02-23 20:36
 2003k 2015/04/13 C:\cygwin64\bin\cygpoppler-46.dll - os=4.0 img=0.0 sys=5.2
                  "cygpoppler-46.dll" v0.0 ts=2015-04-13 18:12
 2049k 2015/04/28 C:\cygwin64\bin\cygpoppler-49.dll - os=4.0 img=0.0 sys=5.2
                  "cygpoppler-49.dll" v0.0 ts=2015-04-28 19:39
 2062k 2015/09/20 C:\cygwin64\bin\cygpoppler-55.dll - os=4.0 img=0.0 sys=5.2
                  "cygpoppler-55.dll" v0.0 ts=2015-09-20 17:24
   41k 2013/10/21 C:\cygwin64\bin\cygpopt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpopt-0.dll" v0.0 ts=2013-10-21 21:52
  148k 2015/10/17 C:\cygwin64\bin\cygpq-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygpq-5.dll" v0.0 ts=2015-10-17 18:00
  113k 2015/06/29 C:\cygwin64\bin\cygproxy-1.dll - os=4.0 img=1.0 sys=5.2
                  "cygproxy-1.dll" v0.0 ts=2015-06-29 22:39
  355k 2015/02/12 C:\cygwin64\bin\cygpstoedit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpstoedit-0.dll" v0.0 ts=2015-02-12 17:10
   38k 2015/10/08 C:\cygwin64\bin\cygptexenc-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygptexenc-1.dll" v0.0 ts=2015-10-08 20:11
  306k 2015/07/02 C:\cygwin64\bin\cygquadmath-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygquadmath-0.dll" v0.0 ts=2015-07-01 18:58
   83k 2013/06/05 C:\cygwin64\bin\cygrarian-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygrarian-0.dll" v0.0 ts=2013-06-05 01:24
  207k 2015/01/27 C:\cygwin64\bin\cygreadline7.dll - os=4.0 img=0.0 sys=5.2
                  "cygreadline7.dll" v0.0 ts=2015-01-27 03:51
  200k 2015/05/18 C:\cygwin64\bin\cygrsvg-2-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygrsvg-2-2.dll" v0.0 ts=2015-05-18 05:13
 2236k 2015/10/02 C:\cygwin64\bin\cygruby220.dll - os=4.0 img=0.0 sys=5.2
                  "cygruby220.dll" v2.2 ts=2015-10-02 03:58
   97k 2014/11/24 C:\cygwin64\bin\cygsasl2-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygsasl2-3.dll" v0.0 ts=2014-11-24 18:22
   84k 2014/12/20 C:\cygwin64\bin\cygserf-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygserf-1-0.dll" v0.0 ts=2014-12-20 16:56
   11k 2015/07/17 C:\cygwin64\bin\cygsigsegv-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygsigsegv-2.dll" v0.0 ts=2015-07-17 22:35
   28k 2014/01/14 C:\cygwin64\bin\cygSM-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygSM-6.dll" v0.0 ts=2014-01-14 23:23
   89k 2015/03/23 C:\cygwin64\bin\cygsmartcols-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygsmartcols-1.dll" v0.0 ts=2015-03-23 09:46
  890k 2015/10/19 C:\cygwin64\bin\cygsqlite3-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsqlite3-0.dll" v0.0 ts=2015-10-19 12:57
  143k 2015/03/17 C:\cygwin64\bin\cygssh2-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygssh2-1.dll" v0.0 ts=2015-03-17 04:00
  421k 2015/07/09 C:\cygwin64\bin\cygssl-1.0.0.dll - os=4.0 img=0.0 sys=5.2
                  "cygssl-1.0.0.dll" v0.0 ts=2015-07-09 17:49
   12k 2015/07/02 C:\cygwin64\bin\cygssp-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygssp-0.dll" v0.0 ts=2015-07-01 18:53
  940k 2015/07/02 C:\cygwin64\bin\cygstdc++-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygstdc++-6.dll" v0.0 ts=2015-07-01 18:17
  386k 2015/09/26 C:\cygwin64\bin\cygsvn_client-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_client-1-0.dll" v0.0 ts=2015-09-26 16:49
   61k 2015/09/26 C:\cygwin64\bin\cygsvn_delta-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_delta-1-0.dll" v0.0 ts=2015-09-26 16:45
   75k 2015/09/26 C:\cygwin64\bin\cygsvn_diff-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_diff-1-0.dll" v0.0 ts=2015-09-26 16:45
   37k 2015/09/26 C:\cygwin64\bin\cygsvn_fs-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_fs-1-0.dll" v0.0 ts=2015-09-26 16:46
  154k 2015/09/26 C:\cygwin64\bin\cygsvn_fs_base-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_fs_base-1-0.dll" v0.0 ts=2015-09-26 16:46
  260k 2015/09/26 C:\cygwin64\bin\cygsvn_fs_fs-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_fs_fs-1-0.dll" v0.0 ts=2015-09-26 16:46
   12k 2015/09/26 C:\cygwin64\bin\cygsvn_fs_util-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_fs_util-1-0.dll" v0.0 ts=2015-09-26 16:45
  271k 2015/09/26 C:\cygwin64\bin\cygsvn_fs_x-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_fs_x-1-0.dll" v0.0 ts=2015-09-26 16:46
   44k 2015/09/26 C:\cygwin64\bin\cygsvn_ra-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_ra-1-0.dll" v0.0 ts=2015-09-26 16:48
   31k 2015/09/26 C:\cygwin64\bin\cygsvn_ra_local-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_ra_local-1-0.dll" v0.0 ts=2015-09-26 16:47
  168k 2015/09/26 C:\cygwin64\bin\cygsvn_ra_serf-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_ra_serf-1-0.dll" v0.0 ts=2015-09-26 16:46
  100k 2015/09/26 C:\cygwin64\bin\cygsvn_ra_svn-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_ra_svn-1-0.dll" v0.0 ts=2015-09-26 16:46
  190k 2015/09/26 C:\cygwin64\bin\cygsvn_repos-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_repos-1-0.dll" v0.0 ts=2015-09-26 16:46
  941k 2015/09/26 C:\cygwin64\bin\cygsvn_subr-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_subr-1-0.dll" v0.0 ts=2015-09-26 16:45
   39k 2015/09/26 C:\cygwin64\bin\cygsvn_swig_perl-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_swig_perl-1-0.dll" v0.0 ts=2015-09-26 16:53
  647k 2015/09/26 C:\cygwin64\bin\cygsvn_wc-1-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygsvn_wc-1-0.dll" v0.0 ts=2015-09-26 16:46
   60k 2015/10/08 C:\cygwin64\bin\cygsynctex-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygsynctex-1.dll" v0.0 ts=2015-10-08 20:21
  242k 2013/04/26 C:\cygwin64\bin\cygt1-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygt1-5.dll" v0.0 ts=2013-04-25 17:35
   66k 2015/08/28 C:\cygwin64\bin\cygtasn1-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygtasn1-6.dll" v0.0 ts=2015-08-28 10:36
  163k 2015/10/08 C:\cygwin64\bin\cygtexlua52-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygtexlua52-5.dll" v0.0 ts=2015-10-08 20:11
  405k 2015/10/08 C:\cygwin64\bin\cygtexluajit-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygtexluajit-2.dll" v0.0 ts=2015-10-08 20:12
   32k 2014/11/12 C:\cygwin64\bin\cygthai-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygthai-0.dll" v0.0 ts=2014-11-12 16:31
   52k 2015/06/09 C:\cygwin64\bin\cygticw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygticw-10.dll" v0.0 ts=2015-06-09 23:56
  363k 2014/05/15 C:\cygwin64\bin\cygtiff-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygtiff-5.dll" v0.0 ts=1970-01-01 00:00
  417k 2015/06/01 C:\cygwin64\bin\cygtiff-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygtiff-6.dll" v0.0 ts=2015-06-01 21:50
   12k 2014/05/15 C:\cygwin64\bin\cygtiffxx-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygtiffxx-5.dll" v0.0 ts=1970-01-01 00:00
   11k 2015/06/01 C:\cygwin64\bin\cygtiffxx-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygtiffxx-6.dll" v0.0 ts=2015-06-01 21:50
  363k 2015/01/12 C:\cygwin64\bin\cygUil-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygUil-4.dll" v0.0 ts=2015-01-12 05:04
 1154k 2013/04/20 C:\cygwin64\bin\cygunistring-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygunistring-0.dll" v0.0 ts=2013-04-20 19:38
 1538k 2015/10/16 C:\cygwin64\bin\cygunistring-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygunistring-2.dll" v0.0 ts=2015-10-16 21:40
   15k 2015/03/23 C:\cygwin64\bin\cyguuid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyguuid-1.dll" v0.0 ts=2015-03-23 09:46
 2191k 2015/10/01 C:\cygwin64\bin\cygvpx-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygvpx-1.dll" v0.0 ts=2015-10-01 21:34
  343k 2015/03/26 C:\cygwin64\bin\cygwebp-5.dll - os=4.0 img=0.0 sys=5.2
                  "cygwebp-5.dll" v0.0 ts=2015-03-26 16:04
   27k 2015/03/26 C:\cygwin64\bin\cygwebpmux-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygwebpmux-1.dll" v0.0 ts=2015-03-26 16:04
 1134k 2015/03/26 C:\cygwin64\bin\cygX11-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygX11-6.dll" v0.0 ts=2015-03-26 15:14
    9k 2015/03/26 C:\cygwin64\bin\cygX11-xcb-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygX11-xcb-1.dll" v0.0 ts=2015-03-26 15:14
   12k 2013/06/06 C:\cygwin64\bin\cygXau-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygXau-6.dll" v0.0 ts=2013-06-06 06:23
  368k 2014/08/10 C:\cygwin64\bin\cygXaw-7.dll - os=4.0 img=0.0 sys=5.2
                  "cygXaw-7.dll" v0.0 ts=1970-01-01 00:00
  102k 2015/09/07 C:\cygwin64\bin\cygxcb-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygxcb-1.dll" v0.0 ts=2015-09-07 05:50
   70k 2015/09/07 C:\cygwin64\bin\cygxcb-glx-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygxcb-glx-0.dll" v0.0 ts=2015-09-07 05:50
   31k 2015/09/07 C:\cygwin64\bin\cygxcb-render-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygxcb-render-0.dll" v0.0 ts=2015-09-07 05:50
   12k 2015/09/07 C:\cygwin64\bin\cygxcb-shm-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygxcb-shm-0.dll" v0.0 ts=2015-09-07 05:50
   21k 2015/03/26 C:\cygwin64\bin\cygXdmcp-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygXdmcp-6.dll" v0.0 ts=2015-03-26 15:38
   56k 2014/08/10 C:\cygwin64\bin\cygXext-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygXext-6.dll" v0.0 ts=1970-01-01 00:00
   73k 2014/08/10 C:\cygwin64\bin\cygXft-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygXft-2.dll" v0.0 ts=1970-01-01 00:00
   56k 2014/08/10 C:\cygwin64\bin\cygXi-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygXi-6.dll" v0.0 ts=1970-01-01 00:00
 2274k 2015/01/12 C:\cygwin64\bin\cygXm-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygXm-4.dll" v0.0 ts=2015-01-12 05:03
 1207k 2014/10/19 C:\cygwin64\bin\cygxml2-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygxml2-2.dll" v0.0 ts=2014-10-19 08:52
   85k 2014/01/15 C:\cygwin64\bin\cygXmu-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygXmu-6.dll" v0.0 ts=2014-01-15 02:27
   59k 2014/01/15 C:\cygwin64\bin\cygXpm-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygXpm-4.dll" v0.0 ts=2014-01-15 00:59
   35k 2013/06/14 C:\cygwin64\bin\cygXrender-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygXrender-1.dll" v0.0 ts=2013-06-14 09:29
  208k 2015/03/18 C:\cygwin64\bin\cygxslt-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygxslt-1.dll" v0.0 ts=2015-03-19 00:39
   12k 2013/03/14 C:\cygwin64\bin\cygXss-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygXss-1.dll" v0.0 ts=2013-03-14 04:07
  320k 2014/08/10 C:\cygwin64\bin\cygXt-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygXt-6.dll" v0.0 ts=1970-01-01 00:00
  121k 2014/12/08 C:\cygwin64\bin\cygyaml-0-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygyaml-0-2.dll" v0.0 ts=2014-12-08 18:19
   80k 2014/11/19 C:\cygwin64\bin\cygz.dll - os=4.0 img=0.0 sys=5.2
                  "cygz.dll" v0.0 ts=2014-11-19 23:08
   61k 2015/03/26 C:\cygwin64\bin\cygzip-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygzip-2.dll" v0.0 ts=2015-03-26 20:04
   24k 2013/05/30 C:\cygwin64\bin\cygzzip-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzip-0-13.dll" v0.0 ts=2013-05-30 03:34
   12k 2013/05/30 C:\cygwin64\bin\cygzzipfseeko-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipfseeko-0-13.dll" v0.0 ts=2013-05-30 03:34
   15k 2013/05/30 C:\cygwin64\bin\cygzzipmmapped-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipmmapped-0-13.dll" v0.0 ts=2013-05-30 03:34
    9k 2013/05/30 C:\cygwin64\bin\cygzzipwrap-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipwrap-0-13.dll" v0.0 ts=2013-05-30 03:34
 3306k 2015/08/20 C:\cygwin64\bin\cygwin1.dll - os=4.0 img=0.0 sys=5.2
                  "cygwin1.dll" v0.0 ts=2015-08-20 10:42
    Cygwin DLL version info:
        DLL version: 2.2.1
        DLL epoch: 19
        DLL old termios: 5
        DLL malloc env: 28
        Cygwin conv: 181
        API major: 0
        API minor: 289
        Shared data: 5
        DLL identifier: cygwin1
        Mount registry: 3
        Cygwin registry name: Cygwin
        Installations name: Installations
        Cygdrive default prefix: 
        Build date: 
        Shared id: cygwin1S5

  449k 2015/02/10 C:\cygwin64\lib\lapack\cygblas-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygblas-0.dll" v0.0 ts=2015-02-10 13:59
 5698k 2015/02/10 C:\cygwin64\lib\lapack\cyglapack-0.dll - os=4.0 img=0.0 sys=5.2
                  "cyglapack-0.dll" v0.0 ts=2015-02-10 13:59

No Cygwin services found.


Cygwin Package Information
Last downloaded files to: C:\Users\myusername\Downloads
Last downloaded files from: http://cygwin.mirror.constant.com/

Package                             Version            Status
_autorebase                         001002-1           OK
_update-info-dir                    00484-1            OK
alternatives                        1.3.30c-10         OK
asciidoc                            8.6.8-1            OK
autoconf                            13-1               OK
autoconf2.1                         2.13-12            OK
autoconf2.5                         2.69-3             OK
autogen                             5.18.4-1           OK
automake                            9-1                OK
automake1.10                        1.10.3-2           OK
automake1.11                        1.11.6-2           OK
automake1.12                        1.12.6-2           OK
automake1.13                        1.13.4-1           OK
automake1.14                        1.14.1-2           OK
automake1.15                        1.15-1             OK
automake1.4                         1.4p6-11           OK
automake1.5                         1.5-11             OK
automake1.6                         1.6.3-12           OK
automake1.7                         1.7.9-11           OK
automake1.8                         1.8.5-11           OK
automake1.9                         1.9.6-11           OK
base-cygwin                         3.8-1              OK
base-files                          4.2-4              OK
bash                                4.3.42-4           OK
bash-completion                     1.3-1              OK
bc                                  1.06.95-2          OK
biber                               2.1-1              OK
binutils                            2.25-1             OK
build-docbook-catalog               1.5-2              OK
bzip2                               1.0.6-2            OK
ca-certificates                     2.5-1              OK
chere                               1.4-1              OK
cmake                               3.3.2-1            OK
coreutils                           8.24-3             OK
crypt                               1.1-1              OK
csih                                0.9.8-6            OK
cygrunsrv                           1.62-1             OK
cygutils                            1.4.14-1           OK
cygutils-extra                      1.4.14-1           OK
cygwin                              2.2.1-1            OK
cygwin-devel                        2.2.1-1            OK
cygwin-doc                          2.1.0-1            OK
cygwin-x-doc                        1.1.20150922-1     OK
dash                                0.5.8-3            OK
dblatex                             0.3.4-1            OK
dbus-doc                            1.8.16-1           OK
dialog                              1.2-20150225-2     OK
diffutils                           3.3-3              OK
docbook-xml412                      4.1.2-2            OK
docbook-xml42                       4.2-4              OK
docbook-xml43                       4.3-2              OK
docbook-xml44                       4.4-2              OK
docbook-xsl                         1.77.1-1           OK
dri-drivers                         11.0.3-1           OK
ed                                  1.11-1             OK
editrights                          1.03-1             OK
file                                5.24-1             OK
findutils                           4.5.12-1           OK
fontconfig                          2.11.1-3           OK
fontconfig-doc                      2.11.1-3           OK
gamin                               0.1.10-15          OK
gawk                                4.1.3-1            OK
getent                              2.18.90-4          OK
gettext                             0.19.5.1-2         OK
gettext-devel                       0.19.5.1-2         OK
gettext-doc                         0.19.5.1-2         OK
ghostscript                         9.15-2             OK
ghostscript-fonts-other             6.0-1              OK
ghostscript-fonts-std               8.11-1             OK
git                                 2.5.3-1            OK
git-completion                      2.5.3-1            OK
git-svn                             2.5.3-1            OK
glade-doc                           3.18.3-1           OK
gnome-doc-utils                     0.20.10-2          OK
Empty package gnutls-doc
gnutls-doc                          3.2.21-1           OK
grep                                2.21-2             OK
groff                               1.22.3-1           OK
gsettings-desktop-schemas           3.14.2-1           OK
gstreamer1.0-plugins-base-doc       1.4.5-1            OK
gstreamer1.0-plugins-good-doc       1.4.5-1            OK
gzip                                1.6-1              OK
hostname                            3.13-1             OK
icu-doc                             56.1-1             OK
ImageMagick                         6.9.1.3-3          OK
info                                6.0-1              OK
ipc-utils                           1.0-2              OK
krb5-doc                            1.13.2-1           OK
less                                471-1              OK
libapr1                             1.5.2-2            OK
libaprutil1                         1.5.4-2            OK
libarchive13                        3.1.2-3            OK
libargp                             20110921-2         OK
libatk1.0-doc                       2.14.0-1           OK
libatspi-doc                        2.14.1-1           OK
libattr1                            2.4.46-1           OK
libautotrace3                       0.31.1-16          OK
libblkid1                           2.25.2-2           OK
libbotan1.10-doc                    1.10.9-2           OK
libbz2_1                            1.0.6-2            OK
libcairo-doc                        1.14.2-1           OK
libcairo2                           1.14.2-1           OK
libcatgets1                         1.1-2              OK
libclutter-gtk0.10-doc              0.10.8-9           OK
libclutter-gtk1.0-doc               1.6.0-1            OK
libclutter1.0-doc                   1.20.2-1           OK
libcogl-doc                         1.18.2-1           OK
libcom_err2                         1.42.12-2          OK
libcroco0.6_3                       0.6.8-1            OK
libcrypt0                           1.1-1              OK
libcurl-doc                         7.45.0-1           OK
libcurl4                            7.45.0-1           OK
libdatrie1                          0.2.8-1            OK
libdb5.3                            5.3.21-1           OK
libdconf-doc                        0.22.0-1           OK
libdialog11                         1.2-20140112-1     OK
libdialog12                         1.2-20150225-2     OK
libedit0                            20130712-1         OK
libEGL1                             11.0.3-1           OK
libEMF1                             1.0.7-1            OK
libexpat1                           2.1.0-3            OK
libfam0                             0.1.10-15          OK
libffi6                             3.2.1-1            OK
libfftw3_3                          3.3.4-2            OK
libfontconfig1                      2.11.1-3           OK
libfpx1                             1.3.1.4-1          OK
libfreetype-doc                     2.5.5-2            OK
libfreetype6                        2.5.5-2            OK
libgailutil-doc                     2.24.28-2          OK
libgailutil3-doc                    3.14.13-1          OK
libgc1                              7.2d-2             OK
libgcc1                             4.9.3-1            OK
libgck1-doc                         3.14.0-2           OK
libgconfmm2.6-doc                   2.28.2-2           OK
libgcr3-doc                         3.14.0-2           OK
libgcrypt11                         1.5.3-2            OK
libgcrypt20                         1.6.3-1            OK
libgd2                              2.0.36RC1-2        OK
libgd3                              2.1.1-1            OK
libgdbm4                            1.11-1             OK
libgdk_pixbuf2.0-doc                2.31.7-1           OK
libgdk_pixbuf2.0_0                  2.31.7-1           OK
libgfortran3                        4.9.3-1            OK
libgif4                             4.1.6-12           OK
libgirepository1.0-doc              1.42.0-1           OK
libGL1                              11.0.3-1           OK
libglapi0                           11.0.3-1           OK
libglib2.0-doc                      2.42.2-1           OK
libglib2.0_0                        2.42.2-1           OK
libglibmm2.4-doc                    2.42.0-1           OK
libgmime2.6-doc                     2.6.20-1           OK
libgmp10                            6.0.0a-2           OK
libgnome-keyring-doc                3.12.0-2           OK
libgnomevfs2-doc                    2.24.4-6           OK
libgnutls-doc                       3.3.17-1           OK
libgomp1                            4.9.3-1            OK
libgoocanvas2.0-doc                 2.0.2-1            OK
libgpg-error0                       1.18-1             OK
libgraphite2_3                      1.2.3-1            OK
libgs9                              9.15-2             OK
libgsf1-doc                         1.14.33-1          OK
libgssapi_krb5_2                    1.13.2-1           OK
libgtk2.0-doc                       2.24.28-2          OK
libgtk3-doc                         3.14.13-1          OK
libgtkmm3.0-doc                     3.14.0-1           OK
libgtksourceview3.0-doc             3.14.4-1           OK
libgtksourceviewmm3.0-doc           3.2.0-2            OK
libgtkspell3-doc                    3.0.6-1            OK
libgtop2.0-doc                      2.30.0-1           OK
libguile17                          1.8.8-1            OK
libharfbuzz-icu0                    1.0.5-1            OK
libharfbuzz0                        1.0.5-1            OK
libICE6                             1.0.9-1            OK
libiconv                            1.14-3             OK
libiconv2                           1.14-3             OK
libicu51                            51.2-1             OK
libicu54                            54.1-1             OK
libicu55                            55.1-1             OK
libicu56                            56.1-1             OK
libidn-doc                          1.29-1             OK
libidn11                            1.29-1             OK
libintl-devel                       0.19.5.1-2         OK
libintl8                            0.19.5.1-2         OK
libiodbc2                           3.52.8-2           OK
libjasper1                          1.900.1-15         OK
libjbig2                            2.0-14             OK
libjpeg8                            1.4.2-1            OK
libjson-glib1.0-doc                 1.0.2-1            OK
libk5crypto3                        1.13.2-1           OK
libkpathsea6                        20150521-3         OK
libkrb5_3                           1.13.2-1           OK
libkrb5support0                     1.13.2-1           OK
liblapack0                          3.5.0r1524-1       OK
libLASi-doc                         1.1.1-2            OK
liblcms1                            1.19-5             OK
liblcms2_2                          2.6-1              OK
libllvm3.4                          3.4.2-5            OK
libllvm3.5                          3.5.2-1            OK
libltdl7                            2.4.6-2            OK
liblzma5                            5.2.1-1            OK
liblzo2_2                           2.08-1             OK
libMagickC++6_5                     6.9.0.0-4          OK
libMagickCore5                      6.7.6.3-4          OK
Empty package libMagickCore6
libMagickCore6                      6.9.0.0-4          OK
libMagickCore6_2                    6.9.1.3-3          OK
libMagickWand6_2                    6.9.1.3-3          OK
libmate-desktop2-doc                1.10.2-1           OK
libmateweather-doc                  1.10.0-1           OK
libmcrypt-doc                       2.5.8-1            OK
libming1                            0.4.7-1            OK
libmpfr4                            3.1.3-1            OK
libmysqlclient18                    5.5.45-1           OK
libncursesw10                       5.9-20150530-1     OK
libneon27                           0.30.1-1           OK
libnetpbm10                         10.71.02-1         OK
libnettle4                          2.7-2              OK
libnotify-doc                       0.7.6-1            OK
libopenjpeg1                        1.5.2-2            OK
libopenldap2_4_2                    2.4.40-2           OK
libopenssl100                       1.0.2d-1           OK
libOpenVG1                          10.3.7-1           OK
libopts-devel                       5.18.4-1           OK
libopts25                           5.18.4-1           OK
liborc0.4-doc                       0.4.23-1           OK
libp11-kit-doc                      0.22.1-1           OK
libp11-kit0                         0.22.1-1           OK
libpango1.0-doc                     1.36.8-1           OK
libpango1.0_0                       1.36.8-1           OK
libpaper-common                     1.1.24-2           OK
libpaper1                           1.1.24-2           OK
libpcre1                            8.37-2             OK
libpipeline-doc                     1.4.0-1            OK
libpipeline1                        1.4.0-1            OK
libpixman1_0                        0.32.6-1           OK
libplotter2                         2.6-4              OK
Empty package libpng-doc
libpng-doc                          1.6.18-1           OK
libpng15                            1.5.22-1           OK
libpng16                            1.6.18-1           OK
libpoppler-glib-doc                 0.36.0-1           OK
libpoppler44                        0.24.5-1           OK
libpoppler46                        0.26.5-3           OK
libpoppler49                        0.30.0-2           OK
libpoppler55                        0.36.0-1           OK
Empty package libpopt0
libpopt0                            1.16-1             OK
libpq5                              9.4.5-1            OK
libproxy1                           0.4.11-5           OK
libpstoedit0                        3.70-1             OK
libptexenc1                         20150521-3         OK
libpulse-doc                        5.0-2              OK
libquadmath0                        4.9.3-1            OK
librarian-devel                     0.8.1-12           OK
librarian0                          0.8.1-12           OK
libreadline7                        6.3.8-1            OK
librest0.7-doc                      0.7.93-1           OK
librsvg2-doc                        2.40.9-1           OK
librsvg2_2                          2.40.9-1           OK
libsasl2_3                          2.1.26-9           OK
libsecret1-doc                      0.18-2             OK
libserf1_0                          1.3.8-1            OK
libsigsegv2                         2.10-2             OK
libSM6                              1.2.2-1            OK
libsmartcols1                       2.25.2-2           OK
libsoup2.4-doc                      2.48.1-1           OK
libsqlite3_0                        3.9.0-1            OK
libssh2_1                           1.5.0-1            OK
libssp0                             4.9.3-1            OK
libstdc++6                          4.9.3-1            OK
libsynctex1                         20150521-3         OK
libtasn1_6                          4.5-1              OK
libtexlua52_5                       20150521-3         OK
libtexluajit2                       20150521-3         OK
libthai0                            0.1.21-1           OK
libtiff5                            3.9.7-4            OK
libtiff6                            4.0.3-3            OK
libtool                             2.4.6-2            OK
libunistring0                       0.9.3-2            OK
libunistring2                       0.9.6-1            OK
libustr                             1.0.4-12           OK
libuuid-devel                       2.25.2-2           OK
libuuid1                            2.25.2-2           OK
libvpx-doc                          1.3.0-2            OK
libvpx1                             1.3.0-2            OK
libwebkitgtk-doc                    2.0.4-4            OK
libwebp5                            0.4.3-1            OK
libwebpmux1                         0.4.3-1            OK
libwmf-doc                          0.2.8.4-15         OK
libX11-doc                          1.6.3-1            OK
libX11-xcb1                         1.6.3-1            OK
libX11_6                            1.6.3-1            OK
libXau6                             1.0.8-1            OK
libXaw7                             1.0.12-2           OK
libxcb-glx0                         1.11.1-1           OK
libxcb-render0                      1.11.1-1           OK
libxcb-shm0                         1.11.1-1           OK
libxcb1                             1.11.1-1           OK
libXdmcp6                           1.1.2-1            OK
libXext6                            1.3.3-1            OK
libXft2                             2.3.2-1            OK
libXi6                              1.7.4-1            OK
libxkbcommon-doc                    0.4.3-1            OK
libXm4                              2.3.4-3            OK
libxml2                             2.9.2-1            OK
libXmu6                             1.1.2-1            OK
libXpm4                             3.5.11-1           OK
libXrender1                         0.9.8-1            OK
libxslt                             1.1.28-2           OK
libXss1                             1.2.2-1            OK
libXt6                              1.1.4-2            OK
libyaml0_2                          0.1.6-2            OK
libzip-doc                          0.11.2-2           OK
libzip2                             0.11.2-2           OK
libzzip0.13                         0.13.62-1          OK
llvm-doc                            3.5.2-1            OK
login                               1.11-1             OK
lynx                                2.8.7-2            OK
m4                                  1.4.17-2           OK
man-db                              2.7.4-1            OK
manlint                             1.6g-2             OK
mate-panel-doc                      1.10.1-1           OK
mintty                              2.1.5-0            OK
netpbm                              10.71.02-1         OK
opencdk                             0.6.6-12           OK
openssh                             7.1p1-1            OK
openssl                             1.0.2d-1           OK
p11-kit                             0.22.1-1           OK
p11-kit-trust                       0.22.1-1           OK
perl                                5.22.0-1           OK
perl-Business-ISBN                  2.09-2             OK
perl-Business-ISBN-Data             20140910.002-2     OK
perl-Business-ISMN                  1.13-2             OK
perl-Business-ISSN                  0.91-2             OK
perl-Carp                           1.3301-2           OK
perl-Data-Compare                   1.25-2             OK
perl-Data-Diver                     1.0101-3           OK
perl-Data-Dump                      1.23-1             OK
perl-Date-Simple                    3.03-2             OK
perl-DBI                            1.634-1            OK
perl-Encode-Locale                  1.05-1             OK
perl-Error                          0.17024-1          OK
perl-Exporter-Tiny                  0.042-2            OK
perl-File-Find-Rule                 0.33-5             OK
perl-File-Listing                   6.04-5             OK
perl-File-Slurp                     9999.19-5          OK
perl-File-Slurp-Tiny                0.004-1            OK
perl-File-Slurp-Unicode             0.7.1-1            OK
perl-File-Which                     1.19-1             OK
perl-HTML-Parser                    3.71-3             OK
perl-HTML-Tagset                    3.20-5             OK
perl-HTTP-Cookies                   6.01-5             OK
perl-HTTP-Daemon                    6.01-5             OK
perl-HTTP-Date                      6.02-5             OK
perl-HTTP-Message                   6.11-1             OK
perl-HTTP-Negotiate                 6.01-5             OK
perl-IO-HTML                        1.001-2            OK
perl-IO-Socket-IP                   0.37-2             OK
perl-IO-Socket-SSL                  2.020-1            OK
perl-IO-String                      1.08-5             OK
perl-IPC-Cmd                        0.92-2             OK
perl-IPC-Run3                       0.048-2            OK
perl-libwww-perl                    6.13-2             OK
perl-List-AllUtils                  0.09-2             OK
perl-List-MoreUtils                 0.413-1            OK
perl-Log-Log4perl                   1.46-2             OK
Empty package perl-LWP
perl-LWP                            6.13-1             OK
perl-LWP-MediaTypes                 6.02-5             OK
perl-LWP-Protocol-https             6.06-2             OK
perl-MIME-Charset                   1.012-2            OK
perl-Mozilla-CA                     20150826-1         OK
perl-Net-HTTP                       6.09-1             OK
perl-Net-SSLeay                     1.72-1             OK
perl-Number-Compare                 0.03-5             OK
perl-Params-Util                    1.07-5             OK
perl-Pod-Simple                     3.31-1             OK
perl-Readonly                       2.00-2             OK
perl-Regexp-Common                  2013031301-3       OK
perl-Scalar-List-Utils              1.42-2             OK
perl-Socket                         2.020-1            OK
perl-Text-BibTeX                    0.71-1             OK
perl-Text-Glob                      0.09-5             OK
perl-Text-Roman                     3.5-1              OK
perl-Tie-Cycle                      1.21-2             OK
perl-TimeDate                       2.30-2             OK
perl-Tk                             804.033-1          OK
perl-Tk-Pod                         0.9942-1           OK
perl-Unicode-Collate                1.14-1             OK
perl-Unicode-LineBreak              2015.07.16-1       OK
perl-Unicode-Normalize              1.17-1             OK
perl-URI                            1.69-1             OK
perl-WWW-RobotRules                 6.02-5             OK
perl-XML-LibXML                     2.0122-2           OK
perl-XML-LibXML-Simple              0.95-2             OK
perl-XML-LibXSLT                    1.94-2             OK
perl-XML-NamespaceSupport           1.11-5             OK
perl-XML-Parser                     2.44-2             OK
perl-XML-SAX                        0.99-5             OK
perl-XML-SAX-Base                   1.08-5             OK
perl-XML-Writer                     0.625-1            OK
perl_autorebase                     5.22.0-1           OK
perl_base                           5.22.0-1           OK
pinfo                               0.6.10-1           OK
pl                                  6.6.6-1            OK
pl-doc                              6.6.6-1            OK
poppler-data                        0.4.6-1            OK
popt                                1.16-1             OK
preview-latex                       11.88-2            OK
python                              2.7.10-1           OK
python-cffi                         0.9.2-1            OK
python-chardet                      2.2.1-1            OK
python-gobject-doc                  2.28.6-5           OK
python-gtk2.0-doc                   2.24.0-3           OK
python-imaging                      2.8.1-1            OK
python-libxml2                      2.9.2-1            OK
python-libxslt                      1.1.28-2           OK
python-numpy                        1.9.2-1            OK
python-ply                          3.6-1              OK
python-pycparser                    2.12-1             OK
python-pygments                     1.6-1              OK
python-pyrex                        0.9.9-2            OK
python-setuptools                   15.2-1             OK
python-tkinter                      2.7.10-1           OK
python3                             3.4.3-1            OK
python3-doc                         3.4.3-1            OK
qt3-doc                             3.3.8b-17          OK
qt5-base-doc                        5.5.1-1            OK
qt5-declarative-doc                 5.5.1-1            OK
qt5-doc                             5.5.1-1            OK
qt5-enginio-doc                     5.5.1-1            OK
qt5-graphicaleffects-doc            5.4.2-1            OK
qt5-imageformats-doc                5.5.1-1            OK
qt5-location-doc                    5.5.1-1            OK
qt5-multimedia-doc                  5.5.1-1            OK
qt5-quickcontrols-doc               5.5.1-1            OK
qt5-serialport-doc                  5.5.1-1            OK
qt5-svg-doc                         5.5.1-1            OK
qt5-tools-doc                       5.5.1-1            OK
qt5-x11extras-doc                   5.5.1-1            OK
qt5-xmlpatterns-doc                 5.5.1-1            OK
rarian                              0.8.1-12           OK
rebase                              4.4.1-1            OK
rgb                                 1.0.5-1            OK
rsync                               3.1.1-1            OK
ruby                                2.2.3-1            OK
ruby-io-console                     0.4.2-2            OK
ruby-json                           1.8.2-1            OK
ruby-minitest4                      4.7.5-1            OK
ruby-psych                          2.0.13-1           OK
ruby-rake                           10.4.2-1           OK
ruby-rdoc                           4.2.0-1            OK
rubygems                            2.4.8-1            OK
run                                 1.3.4-2            OK
sed                                 4.2.2-3            OK
sgml-common                         0.6.3-3            OK
shared-mime-info                    1.4-1              OK
sharutils                           4.15.2-1           OK
subversion                          1.9.2-1            OK
subversion-perl                     1.9.2-1            OK
t1lib5                              5.1.2-1            OK
tar                                 1.28-1             OK
tcl                                 8.5.18-1           OK
tcl-tix                             8.4.3-2            OK
tcl-tk                              8.5.18-1           OK
tcsh                                6.19.00-2          OK
terminfo                            5.9-20150530-1     OK
texinfo                             6.0-1              OK
texlive                             20150521-3         OK
texlive-collection-basic            20150617-3         OK
texlive-collection-bibtexextra      20150521-1         OK
texlive-collection-binextra         20150521-1         OK
texlive-collection-fontsrecommended 20150521-1         OK
texlive-collection-latex            20150521-1         OK
texlive-collection-latexextra       20150521-1         OK
texlive-collection-latexrecommended 20150521-1         OK
texlive-collection-mathextra        20150521-1         OK
texlive-collection-pictures         20150521-1         OK
tiff-doc                            4.0.3-3            OK
transfig                            3.2.5e-2           OK
tzcode                              2015g-1            OK
unrtf                               0.19.3-1           OK
util-linux                          2.25.2-2           OK
uw-imap                             2007f-2            OK
vim                                 7.4.891-1          OK
vim-common                          7.4.891-1          OK
vim-minimal                         7.4.891-1          OK
w3m                                 0.5.3-1            OK
weechat-doc                         1.3-1              OK
which                               2.20-2             OK
xbitmaps                            1.1.1-1            OK
xml2po                              0.20.10-2          OK
xmlto                               0.0.26-1           OK
xorg-docs                           1.7-1              OK
xorg-sgml-doctools                  1.11-1             OK
xpdf                                3.03-4             OK
xxd                                 7.4.891-1          OK
xz                                  5.2.1-1            OK
zlib0                               1.2.8-3            OK
Use -h to see help about each section

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: chere 1.4 bug(?) - "Bash Prompt Here" not shown under Libraries folders
  2015-10-21 12:25 chere 1.4 bug(?) - "Bash Prompt Here" not shown under Libraries folders cpengr
@ 2015-10-21 16:51 ` Achim Gratz
  2015-10-21 18:01   ` cpengr
  0 siblings, 1 reply; 16+ messages in thread
From: Achim Gratz @ 2015-10-21 16:51 UTC (permalink / raw)
  To: cygwin

cpengr writes:
> Under certain circumstances, when I right-click in the empty space in
> Windows Explorer, in any folder or subfolder beneath any "Libraries"
> folder (e.g. my "Documents"), the "Bash Prompt Here" option is not
> shown in the context menu.

"Libraries", despite the looks in Explorer, isn't a folder and not a
place you can set the current directory to.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: chere 1.4 bug(?) - "Bash Prompt Here" not shown under Libraries folders
  2015-10-21 16:51 ` Achim Gratz
@ 2015-10-21 18:01   ` cpengr
  2015-10-21 18:05     ` Bash unable to print epoch timestamp Don Harrop
  0 siblings, 1 reply; 16+ messages in thread
From: cpengr @ 2015-10-21 18:01 UTC (permalink / raw)
  To: cygwin

The folders I'm talking about *are* located on the filesystem, so you
certainly can cd to them.

This is evidenced by the path shown when you click on the location
bar. And also, as described, it works when you click on the folders
themselves (even if you browse to them via Libraries), but doesn't
work when you click the empty space from inside the same folders.

This should work.

cpengr

On 10/21/15, Achim Gratz <Stromeko@nexgo.de> wrote:
> cpengr writes:
>> Under certain circumstances, when I right-click in the empty space in
>> Windows Explorer, in any folder or subfolder beneath any "Libraries"
>> folder (e.g. my "Documents"), the "Bash Prompt Here" option is not
>> shown in the context menu.
>
> "Libraries", despite the looks in Explorer, isn't a folder and not a
> place you can set the current directory to.
>
>
> Regards,
> Achim.
> --
> +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
>
> Samples for the Waldorf Blofeld:
> http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Bash unable to print epoch timestamp
  2015-10-21 18:01   ` cpengr
@ 2015-10-21 18:05     ` Don Harrop
  0 siblings, 0 replies; 16+ messages in thread
From: Don Harrop @ 2015-10-21 18:05 UTC (permalink / raw)
  To: cygwin

Bash outputs no value when using it's built in method of printing an 
"epoch" timestamp.

BashCommandLine#: printf '%(%s)T' -1

I've verified the same behavior with others on IRC.

Below are my relevant pieces of cygcheck.exe -s

Windows 7 Enterprise Ver 6.1 Build 7601 Service Pack 1

Cygwin DLL version info:
     DLL version: 2.2.1
     DLL epoch: 19
     DLL old termios: 5
     DLL malloc env: 28
     Cygwin conv: 181
     API major: 0
     API minor: 289
     Shared data: 5
     DLL identifier: cygwin1
     Mount registry: 3
     Cygwin registry name: Cygwin
     Installations name: Installations
     Cygdrive default prefix:
     Build date:
     Shared id: cygwin1S5

Package                  Version            Status
bash                     4.3.42-3           OK
base-cygwin              3.8-1              OK
base-files               4.2-3              OK
cygwin                   2.2.1-1            OK
util-linux               2.25.2-2           OK


Cheers!
  - Don

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-29  2:50       ` Brian Inglis
@ 2015-10-29  8:19         ` Corinna Vinschen
  0 siblings, 0 replies; 16+ messages in thread
From: Corinna Vinschen @ 2015-10-29  8:19 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]

On Oct 28 17:20, Brian Inglis wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> > On Oct 26 19:16, Brian Inglis wrote:
> > > Sorry - redo with the file existing!
> > 
> > No worries, I applied your other patch since it also cleaned up some
> > whitespaces and, for some reason, the below patch didn't apply cleanly.
> 
> Email paste may have converted tabs to spaces - need to work out how to
> email inline text attachments without tab expansion in tbird - paste on
> gmane (below) seems to retain tabs - may try that in future. 
> 
> > There was just one problem:
> > 
> > > +	  {
> > > +	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
> > > +	    offset = 0;	   subtract to get UTC */
> > 
> > This setting the offset to 0 is necessary, but commented out.  Typo?
> > I fixed this before committing the patch.
> 
> Thanks - total brain fart - Doh! Interesting that gcc -Wall -Wextra did not
> catch this - used to be reliable warning about conditionally uninitialized
> variables! 
> 
> Please check that the second set of tests in Vec1 includes the following, as
> it was not in my very first patch email, which you may not have received: 
> @@ -1502,6 +1575,7 @@ const struct test  Vec1[] = {
>  	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
>  	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
>  	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
> +	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
>  	{ CQ("%S"), 2+1, EXP(CQ("13")) },
>  	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
>  	{ CQ("%T"), 8+1, EXP(CQ("23:01:13")) },

Check.  This was in your patch so it's upstream now.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-27  9:54     ` Corinna Vinschen
@ 2015-10-29  2:50       ` Brian Inglis
  2015-10-29  8:19         ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Inglis @ 2015-10-29  2:50 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:

> 
> On Oct 26 19:16, Brian Inglis wrote:
> > On 2015-10-26 11:34, Brian Inglis wrote:
> > >Third time lucky - pasting inline into email and resending to all
previous lists.
> > >
> > >Please note that conversion into too-small buffer size in regression
test may not have expected result!
> > >
> > >Tried to build with below and variants:
> > >gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf
> -I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o
strftime-s-test strftime.c
> > >gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset,
__get_current_time_locale,
> __tz_lock, __tz_unlock,
> > >_tzset_unlocked
> > >
> > >Build stc with std cmdline and current strftime works and does demo issue.
> > 
> > Sorry - redo with the file existing!
> 
> No worries, I applied your other patch since it also cleaned up some
> whitespaces and, for some reason, the below patch didn't apply cleanly.

Email paste may have converted tabs to spaces - need to work out how to
email inline text attachments without tab expansion in tbird - paste on
gmane (below) seems to retain tabs - may try that in future. 

> There was just one problem:
> 
> > +	  {
> > +	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
> > +	    offset = 0;	   subtract to get UTC */
> 
> This setting the offset to 0 is necessary, but commented out.  Typo?
> I fixed this before committing the patch.

Thanks - total brain fart - Doh! Interesting that gcc -Wall -Wextra did not
catch this - used to be reliable warning about conditionally uninitialized
variables! 

Please check that the second set of tests in Vec1 includes the following, as
it was not in my very first patch email, which you may not have received: 
@@ -1502,6 +1575,7 @@ const struct test  Vec1[] = {
 	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
 	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
 	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
 	{ CQ("%S"), 2+1, EXP(CQ("13")) },
 	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
 	{ CQ("%T"), 8+1, EXP(CQ("23:01:13")) },



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-27  9:27   ` Brian Inglis
  2015-10-27  9:28     ` Brian Inglis
@ 2015-10-27  9:54     ` Corinna Vinschen
  2015-10-29  2:50       ` Brian Inglis
  1 sibling, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2015-10-27  9:54 UTC (permalink / raw)
  To: cygwin, cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]

On Oct 26 19:16, Brian Inglis wrote:
> On 2015-10-26 11:34, Brian Inglis wrote:
> >Third time lucky - pasting inline into email and resending to all previous lists.
> >
> >Please note that conversion into too-small buffer size in regression test may not have expected result!
> >
> >Tried to build with below and variants:
> >gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf -I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o strftime-s-test strftime.c
> >gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset, __get_current_time_locale, __tz_lock, __tz_unlock,
> >_tzset_unlocked
> >
> >Build stc with std cmdline and current strftime works and does demo issue.
> 
> Sorry - redo with the file existing!

No worries, I applied your other patch since it also cleaned up some
whitespaces and, for some reason, the below patch didn't apply cleanly.

There was just one problem:

> +	  {
> +	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
> +	    offset = 0;	   subtract to get UTC */

This setting the offset to 0 is necessary, but commented out.  Typo?
I fixed this before committing the patch.


Thanks again,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-27  9:27   ` Brian Inglis
@ 2015-10-27  9:28     ` Brian Inglis
  2015-10-27  9:54     ` Corinna Vinschen
  1 sibling, 0 replies; 16+ messages in thread
From: Brian Inglis @ 2015-10-27  9:28 UTC (permalink / raw)
  To: cygwin, cygwin-patches, corinna-cygwin

> -------- Forwarded Message --------
> Subject: Fwd: Re: Bash unable to print epoch timestamp
> Date: Fri, 23 Oct 2015 14:32:44 -0600
> From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
> Reply-To: Brian.Inglis@SystematicSw.ab.ca
> Organisation: Systematic Software
> To: corinna-cygwin@cygwin.com
>
> Already forwarded as below to cygwin and ...patches-allow...
> - should be HTML free and pass filters?

On 2015-10-26 11:34, Brian Inglis wrote:
> Third time lucky - pasting inline into email and resending to all previous lists.
>
> Please note that conversion into too-small buffer size in regression test may not have expected result!
>
> Tried to build with below and variants:
> gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf -I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o strftime-s-test strftime.c
> gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset, __get_current_time_locale, __tz_lock, __tz_unlock,
> _tzset_unlocked
>
> Build stc with std cmdline and current strftime works and does demo issue.

Sorry - redo with the file existing!

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

----- >8 ----- 8< -----
/* newlib/libc/time/strftime.c %s format STC */
#include <stdio.h>
#include <time.h>

int main( int argc, char **argv) {
     char ss[BUFSIZ]	= "";
     time_t tt		= time( NULL );
     struct tm *tp	= gmtime( &tt );
     tt			= mktime( tp );
     size_t st		= strftime( ss, sizeof ss, "%s", tp);
     int rc		= puts( ss );
     st			= strftime( ss, sizeof ss, "%T", tp);
     rc			= puts( ss );
     return rc;
}
----- >8 ----- 8< -----
--- a/newlib/ChangeLog	2015-08-20 03:39:23.000000000 -0600
+++ b/newlib/ChangeLog	2015-10-26 18:50:44.165368900 -0600
@@ -1,3 +1,8 @@
+2015-10-12  Brian Inglis  <Brian.Inglis@SystematicSw.ab.ca>
+
+	* libc/time/strftime.c (__strftime): add support for %s (seconds from
+	Unix epoch)
+
  2015-08-07  Stefan Wallentowitz  <stefan.wallentowitz@tum.de>
  
  	* libc/sys/or1k/mlock.c: Fix exception enable saving
--- a/newlib/libc/time/strftime.c	2015-08-20 03:39:24.000000000 -0600
+++ b/newlib/libc/time/strftime.c	2015-10-26 04:27:12.244016200 -0600
@@ -166,6 +166,10 @@ notations, the result is an empty string
  o %R
  The 24-hour time, to the minute.  Equivalent to "%H:%M". [tm_min, tm_hour]
  
+o %s
+The time elapsed, in seconds, since the start of the Unix epoch at
+1970-01-01 00:00:00 UTC.
+
  o %S
  The second, formatted with two digits (from `<<00>>' to `<<60>>').  The
  value 60 accounts for the occasional leap second. [tm_sec]
@@ -1109,6 +1113,74 @@ recurse:
  			  tim_p->tm_hour, tim_p->tm_min);
            CHECK_LENGTH ();
            break;
+	case CQ('s'):
+/*
+ * From:
+ * The Open Group Base Specifications Issue 7
+ * IEEE Std 1003.1, 2013 Edition
+ * Copyright (c) 2001-2013 The IEEE and The Open Group
+ * XBD Base Definitions
+ * 4. General Concepts
+ * 4.15 Seconds Since the Epoch
+ * A value that approximates the number of seconds that have elapsed since the
+ * Epoch. A Coordinated Universal Time name (specified in terms of seconds
+ * (tm_sec), minutes (tm_min), hours (tm_hour), days since January 1 of the year
+ * (tm_yday), and calendar year minus 1900 (tm_year)) is related to a time
+ * represented as seconds since the Epoch, according to the expression below.
+ * If the year is <1970 or the value is negative, the relationship is undefined.
+ * If the year is >=1970 and the value is non-negative, the value is related to a
+ * Coordinated Universal Time name according to the C-language expression, where
+ * tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all integer types:
+ * tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
+ *     (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
+ *     ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
+ * OR
+ * ((((tm_year-69)/4 - (tm_year-1)/100 + (tm_year+299)/400 +
+ *         (tm_year-70)*365 + tm_yday)*24 + tm_hour)*60 + tm_min)*60 + tm_sec
+ */
+/* modified from %z case by hoisting offset outside if block and initializing */
+	  {
+	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
+	    offset = 0;	   subtract to get UTC */
+
+	    if (tim_p->tm_isdst >= 0)
+	      {
+		TZ_LOCK;
+		if (!tzset_called)
+		  {
+		    _tzset_unlocked ();
+		    tzset_called = 1;
+		  }
+
+#if defined (__CYGWIN__)
+		/* Cygwin must check if the application has been built with or
+		   without the extra tm members for backward compatibility, and
+		   then use either that or the old method fetching from tzinfo.
+		   Rather than pulling in the version check infrastructure, we
+		   just call a Cygwin function. */
+		extern long __cygwin_gettzoffset (const struct tm *tmp);
+		offset = __cygwin_gettzoffset (tim_p);
+#elif defined (__TM_GMTOFF)
+		offset = tim_p->__TM_GMTOFF;
+#else
+		__tzinfo_type *tz = __gettzinfo ();
+		/* The sign of this is exactly opposite the envvar TZ.  We
+		   could directly use the global _timezone for tm_isdst==0,
+		   but have to use __tzrule for daylight savings.  */
+		offset = -tz->__tzrule[tim_p->tm_isdst > 0].offset;
+#endif
+		TZ_UNLOCK;
+	      }
+	    len = snprintf (&s[count], maxsize - count, CQ("%lld"),
+			    (((((long long)tim_p->tm_year - 69)/4
+				- (tim_p->tm_year - 1)/100
+				+ (tim_p->tm_year + 299)/400
+				+ (tim_p->tm_year - 70)*365 + tim_p->tm_yday)*24
+			      + tim_p->tm_hour)*60 + tim_p->tm_min)*60
+			    + tim_p->tm_sec - offset);
+	    CHECK_LENGTH ();
+	  }
+          break;
  	case CQ('S'):
  #ifdef _WANT_C99_TIME_FORMATS
  	  if (alt != CQ('O') || !*alt_digits
@@ -1442,6 +1514,7 @@ const struct test  Vec0[] = {
  	{ CQ("%p"), 2+1, EXP(CQ("AM")) },
  	{ CQ("%r"), 11+1, EXP(CQ("09:53:47 AM")) },
  	{ CQ("%R"), 5+1, EXP(CQ("09:53")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1230648827")) },
  	{ CQ("%S"), 2+1, EXP(CQ("47")) },
  	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
  	{ CQ("%T"), 8+1, EXP(CQ("09:53:47")) },
@@ -1502,6 +1575,7 @@ const struct test  Vec1[] = {
  	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
  	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
  	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
  	{ CQ("%S"), 2+1, EXP(CQ("13")) },
  	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
  	{ CQ("%T"), 8+1, EXP(CQ("23:01:13")) },


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-26 19:54 ` Brian Inglis
  2015-10-26 20:22   ` Brian Inglis
@ 2015-10-27  9:27   ` Brian Inglis
  2015-10-27  9:28     ` Brian Inglis
  2015-10-27  9:54     ` Corinna Vinschen
  1 sibling, 2 replies; 16+ messages in thread
From: Brian Inglis @ 2015-10-27  9:27 UTC (permalink / raw)
  To: cygwin, cygwin-patches, corinna-cygwin

> -------- Forwarded Message --------
> Subject: Fwd: Re: Bash unable to print epoch timestamp
> Date: Fri, 23 Oct 2015 14:32:44 -0600
> From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
> Reply-To: Brian.Inglis@SystematicSw.ab.ca
> Organisation: Systematic Software
> To: corinna-cygwin@cygwin.com
>
> Already forwarded as below to cygwin and ...patches-allow...
> - should be HTML free and pass filters?

On 2015-10-26 11:34, Brian Inglis wrote:
> Third time lucky - pasting inline into email and resending to all previous lists.
>
> Please note that conversion into too-small buffer size in regression test may not have expected result!
>
> Tried to build with below and variants:
> gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf -I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o strftime-s-test strftime.c
> gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset, __get_current_time_locale, __tz_lock, __tz_unlock,
> _tzset_unlocked
>
> Build stc with std cmdline and current strftime works and does demo issue.

Sorry - redo with the file existing!

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

----- >8 ----- 8< -----
/* newlib/libc/time/strftime.c %s format STC */
#include <stdio.h>
#include <time.h>

int main( int argc, char **argv) {
     char ss[BUFSIZ]	= "";
     time_t tt		= time( NULL );
     struct tm *tp	= gmtime( &tt );
     tt			= mktime( tp );
     size_t st		= strftime( ss, sizeof ss, "%s", tp);
     int rc		= puts( ss );
     st			= strftime( ss, sizeof ss, "%T", tp);
     rc			= puts( ss );
     return rc;
}
----- >8 ----- 8< -----
--- a/newlib/ChangeLog	2015-08-20 03:39:23.000000000 -0600
+++ b/newlib/ChangeLog	2015-10-26 18:50:44.165368900 -0600
@@ -1,3 +1,8 @@
+2015-10-12  Brian Inglis  <Brian.Inglis@SystematicSw.ab.ca>
+
+	* libc/time/strftime.c (__strftime): add support for %s (seconds from
+	Unix epoch)
+
  2015-08-07  Stefan Wallentowitz  <stefan.wallentowitz@tum.de>
  
  	* libc/sys/or1k/mlock.c: Fix exception enable saving
--- a/newlib/libc/time/strftime.c	2015-08-20 03:39:24.000000000 -0600
+++ b/newlib/libc/time/strftime.c	2015-10-26 04:27:12.244016200 -0600
@@ -166,6 +166,10 @@ notations, the result is an empty string
  o %R
  The 24-hour time, to the minute.  Equivalent to "%H:%M". [tm_min, tm_hour]
  
+o %s
+The time elapsed, in seconds, since the start of the Unix epoch at
+1970-01-01 00:00:00 UTC.
+
  o %S
  The second, formatted with two digits (from `<<00>>' to `<<60>>').  The
  value 60 accounts for the occasional leap second. [tm_sec]
@@ -1109,6 +1113,74 @@ recurse:
  			  tim_p->tm_hour, tim_p->tm_min);
            CHECK_LENGTH ();
            break;
+	case CQ('s'):
+/*
+ * From:
+ * The Open Group Base Specifications Issue 7
+ * IEEE Std 1003.1, 2013 Edition
+ * Copyright (c) 2001-2013 The IEEE and The Open Group
+ * XBD Base Definitions
+ * 4. General Concepts
+ * 4.15 Seconds Since the Epoch
+ * A value that approximates the number of seconds that have elapsed since the
+ * Epoch. A Coordinated Universal Time name (specified in terms of seconds
+ * (tm_sec), minutes (tm_min), hours (tm_hour), days since January 1 of the year
+ * (tm_yday), and calendar year minus 1900 (tm_year)) is related to a time
+ * represented as seconds since the Epoch, according to the expression below.
+ * If the year is <1970 or the value is negative, the relationship is undefined.
+ * If the year is >=1970 and the value is non-negative, the value is related to a
+ * Coordinated Universal Time name according to the C-language expression, where
+ * tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all integer types:
+ * tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
+ *     (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
+ *     ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
+ * OR
+ * ((((tm_year-69)/4 - (tm_year-1)/100 + (tm_year+299)/400 +
+ *         (tm_year-70)*365 + tm_yday)*24 + tm_hour)*60 + tm_min)*60 + tm_sec
+ */
+/* modified from %z case by hoisting offset outside if block and initializing */
+	  {
+	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
+	    offset = 0;	   subtract to get UTC */
+
+	    if (tim_p->tm_isdst >= 0)
+	      {
+		TZ_LOCK;
+		if (!tzset_called)
+		  {
+		    _tzset_unlocked ();
+		    tzset_called = 1;
+		  }
+
+#if defined (__CYGWIN__)
+		/* Cygwin must check if the application has been built with or
+		   without the extra tm members for backward compatibility, and
+		   then use either that or the old method fetching from tzinfo.
+		   Rather than pulling in the version check infrastructure, we
+		   just call a Cygwin function. */
+		extern long __cygwin_gettzoffset (const struct tm *tmp);
+		offset = __cygwin_gettzoffset (tim_p);
+#elif defined (__TM_GMTOFF)
+		offset = tim_p->__TM_GMTOFF;
+#else
+		__tzinfo_type *tz = __gettzinfo ();
+		/* The sign of this is exactly opposite the envvar TZ.  We
+		   could directly use the global _timezone for tm_isdst==0,
+		   but have to use __tzrule for daylight savings.  */
+		offset = -tz->__tzrule[tim_p->tm_isdst > 0].offset;
+#endif
+		TZ_UNLOCK;
+	      }
+	    len = snprintf (&s[count], maxsize - count, CQ("%lld"),
+			    (((((long long)tim_p->tm_year - 69)/4
+				- (tim_p->tm_year - 1)/100
+				+ (tim_p->tm_year + 299)/400
+				+ (tim_p->tm_year - 70)*365 + tim_p->tm_yday)*24
+			      + tim_p->tm_hour)*60 + tim_p->tm_min)*60
+			    + tim_p->tm_sec - offset);
+	    CHECK_LENGTH ();
+	  }
+          break;
  	case CQ('S'):
  #ifdef _WANT_C99_TIME_FORMATS
  	  if (alt != CQ('O') || !*alt_digits
@@ -1442,6 +1514,7 @@ const struct test  Vec0[] = {
  	{ CQ("%p"), 2+1, EXP(CQ("AM")) },
  	{ CQ("%r"), 11+1, EXP(CQ("09:53:47 AM")) },
  	{ CQ("%R"), 5+1, EXP(CQ("09:53")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1230648827")) },
  	{ CQ("%S"), 2+1, EXP(CQ("47")) },
  	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
  	{ CQ("%T"), 8+1, EXP(CQ("09:53:47")) },
@@ -1502,6 +1575,7 @@ const struct test  Vec1[] = {
  	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
  	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
  	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
  	{ CQ("%S"), 2+1, EXP(CQ("13")) },
  	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
  	{ CQ("%T"), 8+1, EXP(CQ("23:01:13")) },


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-26 10:50     ` Corinna Vinschen
@ 2015-10-26 23:11       ` Brian Inglis
  0 siblings, 0 replies; 16+ messages in thread
From: Brian Inglis @ 2015-10-26 23:11 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen writes:
> 
> Brian, ping?

Hi Corinna,
Just sent third try to this list, -patches, and yourself: 
May have been blocked because thunderbird decided to base64 encode the stc
attachment ("smart" attachments?) whereas the patch was inlined properly! 
Note in latest attempt:

"Third time lucky - pasting inline into email and resending to all previous
lists.

Please note that conversion into too-small buffer size in regression test
may not have expected result!

Tried to build with below and variants:
gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf
-I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o
strftime-s-test strftime.c
gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset,
__get_current_time_locale, __tz_lock, __tz_unlock,
_tzset_unlocked

Build stc with std cmdline and current strftime works and does demo issue."


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-26 19:54 ` Brian Inglis
@ 2015-10-26 20:22   ` Brian Inglis
  2015-10-27  9:27   ` Brian Inglis
  1 sibling, 0 replies; 16+ messages in thread
From: Brian Inglis @ 2015-10-26 20:22 UTC (permalink / raw)
  To: cygwin, cygwin-patches, corinna-cygwin

Third time lucky - pasting inline into email and resending to all previous lists.

Please note that conversion into too-small buffer size in regression test may not have expected result!

Tried to build with below and variants:
gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf -I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o strftime-s-test strftime.c
gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset, __get_current_time_locale, __tz_lock, __tz_unlock,
_tzset_unlocked

Build stc with std cmdline and current strftime works and does demo issue.

-------- Forwarded Message --------
Subject: Fwd: Re: Bash unable to print epoch timestamp
Date: Fri, 23 Oct 2015 14:32:44 -0600
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Reply-To: Brian.Inglis@SystematicSw.ab.ca
Organisation: Systematic Software
To: corinna-cygwin@cygwin.com

Already forwarded as below to cygwin and ...patches-allow...
- should be HTML free and pass filters?
-- 
Take care. Thanks, Brian Inglis


-------- Forwarded Message --------
Subject: Re: Bash unable to print epoch timestamp
Date: Thu, 22 Oct 2015 18:08:52 -0600
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Reply-To: Brian.Inglis@SystematicSw.ab.ca
Organisation: Systematic Software
To: cygwin@cygwin.com, cygwin-patches-allow-subscribe@cygwin.com

Corinna Vinschen <corinna-cygwin <at> cygwin.com> wrote:
> On Oct 22 07:03, Brian Inglis wrote:
>> Brian Inglis <Brian.Inglis <at> SystematicSw.ab.ca> writes:
>> > Don Harrop <don <at> effx.us> writes:
>> > > Bash outputs no value when using it's built in method of printing an
>> > > "epoch" timestamp.
>> > > BashCommandLine#: printf '%(%s)T' -1
>> > bash printf depends on underlying strftime in newlib, which does not support
>> > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
>> > is presumably not defined in the config, as %s is not shown in man strftime.
>> > Workaround for now is use
>> > date +%s
>> > for current time, and
>> > date -d $(printf '%(%T)T' -2) +%s
>> > for shell invocation time.
>> > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
>> Wrong! Misread the code, strftime %s is not supported!

>> STC and suggested patch appended (posting from gmane), compiles, but can't
>> build STC as ld fails with undef refs, and I don't know all the correct
>> LD..., -L and -l incantations. Email me for original files.
> Cool, thanks for the patch. Unfortunately it doesn't apply cleanly.
> There are several unexpected line wraps and there's this:
>> --- a/newlib/time/strftime.c 2015-08-20 03:39:24.000000000 -0600
>> +++ b/newlib/time/strftime.c 2015-10-21 20:15:22.367453000 -0600
> How did this happen? If you checkout the newlib-cygwin git repo,
> strftime.c is under newlib/libc/time, not under newlib/time :o

Tried to download and build from source tarball, then cygport, then
local source file, but some unobvious build prereqs missing in all
cases, as reported by ld. Finally just diffed local source against
distro and posted from gmane, with attempted fixups in the post.

> Would you mind to attach a patch generated with git format-patch?

Sorry, not using git yet, as I am set up with hg on BitBucket
- AIUI the output is close enough the attached should work okay.

[cc ...patches-allow...]


-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada


----- >8 ----- 8< -----
/* newlib/libc/time/strftime.c %s format STC */
#include <stdio.h>
#include <time.h>

int main( int argc, char **argv) {
     char ss[BUFSIZ]	= "";
     time_t tt		= time( NULL );
     struct tm *tp	= gmtime( &tt );
     tt			= mktime( tp );
     size_t st		= strftime( ss, sizeof ss, "%s", tp);
     int rc		= puts( ss );
     st			= strftime( ss, sizeof ss, "%T", tp);
     rc			= puts( ss );
     return rc;
}
----- >8 ----- 8< -----
2015-10-12  Brian Inglis  <Brian.Inglis@SystematicSw.ab.ca>

	* newlib/libc/time/strftime.c (__strftime): add support for %s
	(seconds from Unix epoch)

--- a/newlib/libc/time/strftime.c	1969-12-31 17:00:00.000000000 -0700
+++ b/newlib/libc/time/strftime.c	2015-10-26 04:27:12.244016200 -0600
@@ -0,0 +1,1903 @@
+/* NOTE:  This file defines both strftime() and wcsftime().  Take care when
+ * making changes.  See also wcsftime.c, and note the (small) overlap in the
+ * manual description, taking care to edit both as needed.  */
+/*
+ * strftime.c
+ * Original Author:	G. Haley
+ * Additions from:	Eric Blake
+ * Changes to allow dual use as wcstime, also:	Craig Howland
+ *
+ * Places characters into the array pointed to by s as controlled by the string
+ * pointed to by format. If the total number of resulting characters including
+ * the terminating null character is not more than maxsize, returns the number
+ * of characters placed into the array pointed to by s (not including the
+ * terminating null character); otherwise zero is returned and the contents of
+ * the array indeterminate.
+ */
+
+/*
+FUNCTION
+<<strftime>>---convert date and time to a formatted string
+
+INDEX
+	strftime
+
+ANSI_SYNOPSIS
+	#include <time.h>
+	size_t strftime(char *restrict <[s]>, size_t <[maxsize]>,
+			const char *restrict <[format]>,
+                        const struct tm *restrict <[timp]>);
+
+TRAD_SYNOPSIS
+	#include <time.h>
+	size_t strftime(<[s]>, <[maxsize]>, <[format]>, <[timp]>)
+	char *<[s]>;
+	size_t <[maxsize]>;
+	char *<[format]>;
+	struct tm *<[timp]>;
+
+DESCRIPTION
+<<strftime>> converts a <<struct tm>> representation of the time (at
+<[timp]>) into a null-terminated string, starting at <[s]> and occupying
+no more than <[maxsize]> characters.
+
+You control the format of the output using the string at <[format]>.
+<<*<[format]>>> can contain two kinds of specifications: text to be
+copied literally into the formatted string, and time conversion
+specifications.  Time conversion specifications are two- and
+three-character sequences beginning with `<<%>>' (use `<<%%>>' to
+include a percent sign in the output).  Each defined conversion
+specification selects only the specified field(s) of calendar time
+data from <<*<[timp]>>>, and converts it to a string in one of the
+following ways:
+
+o+
+o %a
+The abbreviated weekday name according to the current locale. [tm_wday]
+
+o %A
+The full weekday name according to the current locale.
+In the default "C" locale, one of `<<Sunday>>', `<<Monday>>', `<<Tuesday>>',
+`<<Wednesday>>', `<<Thursday>>', `<<Friday>>', `<<Saturday>>'. [tm_wday]
+
+o %b
+The abbreviated month name according to the current locale. [tm_mon]
+
+o %B
+The full month name according to the current locale.
+In the default "C" locale, one of `<<January>>', `<<February>>',
+`<<March>>', `<<April>>', `<<May>>', `<<June>>', `<<July>>',
+`<<August>>', `<<September>>', `<<October>>', `<<November>>',
+`<<December>>'. [tm_mon]
+
+o %c
+The preferred date and time representation for the current locale.
+[tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_wday]
+
+o %C
+The century, that is, the year divided by 100 then truncated.  For
+4-digit years, the result is zero-padded and exactly two characters;
+but for other years, there may a negative sign or more digits.  In
+this way, `<<%C%y>>' is equivalent to `<<%Y>>'. [tm_year]
+
+o %d
+The day of the month, formatted with two digits (from `<<01>>' to
+`<<31>>'). [tm_mday]
+
+o %D
+A string representing the date, in the form `<<"%m/%d/%y">>'.
+[tm_mday, tm_mon, tm_year]
+
+o %e
+The day of the month, formatted with leading space if single digit
+(from `<<1>>' to `<<31>>'). [tm_mday]
+
+o %E<<x>>
+In some locales, the E modifier selects alternative representations of
+certain modifiers <<x>>.  In newlib, it is ignored, and treated as %<<x>>.
+
+o %F
+A string representing the ISO 8601:2000 date format, in the form
+`<<"%Y-%m-%d">>'. [tm_mday, tm_mon, tm_year]
+
+o %g
+The last two digits of the week-based year, see specifier %G (from
+`<<00>>' to `<<99>>'). [tm_year, tm_wday, tm_yday]
+
+o %G
+The week-based year. In the ISO 8601:2000 calendar, week 1 of the year
+includes January 4th, and begin on Mondays. Therefore, if January 1st,
+2nd, or 3rd falls on a Sunday, that day and earlier belong to the last
+week of the previous year; and if December 29th, 30th, or 31st falls
+on Monday, that day and later belong to week 1 of the next year.  For
+consistency with %Y, it always has at least four characters.
+Example: "%G" for Saturday 2nd January 1999 gives "1998", and for
+Tuesday 30th December 1997 gives "1998". [tm_year, tm_wday, tm_yday]
+
+o %h
+Synonym for "%b". [tm_mon]
+
+o %H
+The hour (on a 24-hour clock), formatted with two digits (from
+`<<00>>' to `<<23>>'). [tm_hour]
+
+o %I
+The hour (on a 12-hour clock), formatted with two digits (from
+`<<01>>' to `<<12>>'). [tm_hour]
+
+o %j
+The count of days in the year, formatted with three digits
+(from `<<001>>' to `<<366>>'). [tm_yday]
+
+o %k
+The hour (on a 24-hour clock), formatted with leading space if single
+digit (from `<<0>>' to `<<23>>'). Non-POSIX extension (c.p. %I). [tm_hour]
+
+o %l
+The hour (on a 12-hour clock), formatted with leading space if single
+digit (from `<<1>>' to `<<12>>'). Non-POSIX extension (c.p. %H). [tm_hour]
+
+o %m
+The month number, formatted with two digits (from `<<01>>' to `<<12>>').
+[tm_mon]
+
+o %M
+The minute, formatted with two digits (from `<<00>>' to `<<59>>'). [tm_min]
+
+o %n
+A newline character (`<<\n>>').
+
+o %O<<x>>
+In some locales, the O modifier selects alternative digit characters
+for certain modifiers <<x>>.  In newlib, it is ignored, and treated as %<<x>>.
+
+o %p
+Either `<<AM>>' or `<<PM>>' as appropriate, or the corresponding strings for
+the current locale. [tm_hour]
+
+o %P
+Same as '<<%p>>', but in lowercase.  This is a GNU extension. [tm_hour]
+
+o %r
+Replaced by the time in a.m. and p.m. notation.  In the "C" locale this
+is equivalent to "%I:%M:%S %p".  In locales which don't define a.m./p.m.
+notations, the result is an empty string. [tm_sec, tm_min, tm_hour]
+
+o %R
+The 24-hour time, to the minute.  Equivalent to "%H:%M". [tm_min, tm_hour]
+
+o %s
+The time elapsed, in seconds, since the start of the Unix epoch at
+1970-01-01 00:00:00 UTC.
+
+o %S
+The second, formatted with two digits (from `<<00>>' to `<<60>>').  The
+value 60 accounts for the occasional leap second. [tm_sec]
+
+o %t
+A tab character (`<<\t>>').
+
+o %T
+The 24-hour time, to the second.  Equivalent to "%H:%M:%S". [tm_sec,
+tm_min, tm_hour]
+
+o %u
+The weekday as a number, 1-based from Monday (from `<<1>>' to
+`<<7>>'). [tm_wday]
+
+o %U
+The week number, where weeks start on Sunday, week 1 contains the first
+Sunday in a year, and earlier days are in week 0.  Formatted with two
+digits (from `<<00>>' to `<<53>>').  See also <<%W>>. [tm_wday, tm_yday]
+
+o %V
+The week number, where weeks start on Monday, week 1 contains January 4th,
+and earlier days are in the previous year.  Formatted with two digits
+(from `<<01>>' to `<<53>>').  See also <<%G>>. [tm_year, tm_wday, tm_yday]
+
+o %w
+The weekday as a number, 0-based from Sunday (from `<<0>>' to `<<6>>').
+[tm_wday]
+
+o %W
+The week number, where weeks start on Monday, week 1 contains the first
+Monday in a year, and earlier days are in week 0.  Formatted with two
+digits (from `<<00>>' to `<<53>>'). [tm_wday, tm_yday]
+
+o %x
+Replaced by the preferred date representation in the current locale.
+In the "C" locale this is equivalent to "%m/%d/%y".
+[tm_mon, tm_mday, tm_year]
+
+o %X
+Replaced by the preferred time representation in the current locale.
+In the "C" locale this is equivalent to "%H:%M:%S". [tm_sec, tm_min, tm_hour]
+
+o %y
+The last two digits of the year (from `<<00>>' to `<<99>>'). [tm_year]
+(Implementation interpretation:  always positive, even for negative years.)
+
+o %Y
+The full year, equivalent to <<%C%y>>.  It will always have at least four
+characters, but may have more.  The year is accurate even when tm_year
+added to the offset of 1900 overflows an int. [tm_year]
+
+o %z
+The offset from UTC.  The format consists of a sign (negative is west of
+Greewich), two characters for hour, then two characters for minutes
+(-hhmm or +hhmm).  If tm_isdst is negative, the offset is unknown and no
+output is generated; if it is zero, the offset is the standard offset for
+the current time zone; and if it is positive, the offset is the daylight
+savings offset for the current timezone. The offset is determined from
+the TZ environment variable, as if by calling tzset(). [tm_isdst]
+
+o %Z
+The time zone name.  If tm_isdst is negative, no output is generated.
+Otherwise, the time zone name is based on the TZ environment variable,
+as if by calling tzset(). [tm_isdst]
+
+o %%
+A single character, `<<%>>'.
+o-
+
+RETURNS
+When the formatted time takes up no more than <[maxsize]> characters,
+the result is the length of the formatted string.  Otherwise, if the
+formatting operation was abandoned due to lack of room, the result is
+<<0>>, and the string starting at <[s]> corresponds to just those
+parts of <<*<[format]>>> that could be completely filled in within the
+<[maxsize]> limit.
+
+PORTABILITY
+ANSI C requires <<strftime>>, but does not specify the contents of
+<<*<[s]>>> when the formatted string would require more than
+<[maxsize]> characters.  Unrecognized specifiers and fields of
+<<timp>> that are out of range cause undefined results.  Since some
+formats expand to 0 bytes, it is wise to set <<*<[s]>>> to a nonzero
+value beforehand to distinguish between failure and an empty string.
+This implementation does not support <<s>> being NULL, nor overlapping
+<<s>> and <<format>>.
+
+<<strftime>> requires no supporting OS subroutines.
+
+BUGS
+<<strftime>> ignores the LC_TIME category of the current locale, hard-coding
+the "C" locale settings.
+*/
+
+#include <newlib.h>
+#include <sys/config.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <ctype.h>
+#include <wctype.h>
+#include "local.h"
+#include "../locale/timelocal.h"
+
+/* Defines to make the file dual use for either strftime() or wcsftime().
+ * To get wcsftime, define MAKE_WCSFTIME.
+ * To get strftime, do not define MAKE_WCSFTIME.
+ * Names are kept friendly to strftime() usage.  The biggest ugliness is the
+ * use of the CQ() macro to make either regular character constants and
+ * string literals or wide-character constants and wide-character-string
+ * literals, as appropriate.  */
+#if !defined(MAKE_WCSFTIME)
+#  define CHAR		char		/* string type basis */
+#  define CQ(a)		a		/* character constant qualifier */
+#  define SFLG				/* %s flag (null for normal char) */
+#  define _ctloc(x) (ctloclen = strlen (ctloc = _CurrentTimeLocale->x), ctloc)
+#  define snprintf	sniprintf	/* avoid to pull in FP functions. */
+#  define TOLOWER(c)	tolower((int)(unsigned char)(c))
+#  define STRTOUL(c,p,b) strtoul((c),(p),(b))
+#  define STRCPY(a,b)	strcpy((a),(b))
+#  define STRCHR(a,b)	strchr((a),(b))
+#  define STRLEN(a)	strlen(a)
+# else
+#  define strftime	wcsftime	/* Alternate function name */
+#  define CHAR		wchar_t		/* string type basis */
+#  define CQ(a)		L##a		/* character constant qualifier */
+#  define snprintf	swprintf	/* wide-char equivalent function name */
+#  define strncmp	wcsncmp		/* wide-char equivalent function name */
+#  define TOLOWER(c)	towlower((wint_t)(c))
+#  define STRTOUL(c,p,b) wcstoul((c),(p),(b))
+#  define STRCPY(a,b)	wcscpy((a),(b))
+#  define STRCHR(a,b)	wcschr((a),(b))
+#  define STRLEN(a)	wcslen(a)
+#  define SFLG		"l"		/* %s flag (l for wide char) */
+#  ifdef __HAVE_LOCALE_INFO_EXTENDED__
+#   define _ctloc(x) (ctloclen = wcslen (ctloc = _CurrentTimeLocale->w##x), \
+		      ctloc)
+#  else
+#   define CTLOCBUFLEN   256		/* Arbitrary big buffer size */
+    const wchar_t *
+    __ctloc (wchar_t *buf, const char *elem, size_t *len_ret)
+    {
+      buf[CTLOCBUFLEN - 1] = L'\0';
+      *len_ret = mbstowcs (buf, elem, CTLOCBUFLEN - 1);
+      if (*len_ret == (size_t) -1 )
+	*len_ret = 0;
+      return buf;
+    }
+#   define _ctloc(x) (ctloc = __ctloc (ctlocbuf, _CurrentTimeLocale->x, \
+		      &ctloclen))
+#  endif
+#endif  /* MAKE_WCSFTIME */
+
+#define CHECK_LENGTH()	if (len < 0 || (count += len) >= maxsize) \
+			  return 0
+
+/* Enforce the coding assumptions that YEAR_BASE is positive.  (%C, %Y, etc.) */
+#if YEAR_BASE < 0
+#  error "YEAR_BASE < 0"
+#endif
+
+static _CONST int dname_len[7] =
+{6, 6, 7, 9, 8, 6, 8};
+
+/* Using the tm_year, tm_wday, and tm_yday components of TIM_P, return
+   -1, 0, or 1 as the adjustment to add to the year for the ISO week
+   numbering used in "%g%G%V", avoiding overflow.  */
+static int
+_DEFUN (iso_year_adjust, (tim_p),
+	_CONST struct tm *tim_p)
+{
+  /* Account for fact that tm_year==0 is year 1900.  */
+  int leap = isleap (tim_p->tm_year + (YEAR_BASE
+				       - (tim_p->tm_year < 0 ? 0 : 2000)));
+
+  /* Pack the yday, wday, and leap year into a single int since there are so
+     many disparate cases.  */
+#define PACK(yd, wd, lp) (((yd) << 4) + (wd << 1) + (lp))
+  switch (PACK (tim_p->tm_yday, tim_p->tm_wday, leap))
+    {
+    case PACK (0, 5, 0): /* Jan 1 is Fri, not leap.  */
+    case PACK (0, 6, 0): /* Jan 1 is Sat, not leap.  */
+    case PACK (0, 0, 0): /* Jan 1 is Sun, not leap.  */
+    case PACK (0, 5, 1): /* Jan 1 is Fri, leap year.  */
+    case PACK (0, 6, 1): /* Jan 1 is Sat, leap year.  */
+    case PACK (0, 0, 1): /* Jan 1 is Sun, leap year.  */
+    case PACK (1, 6, 0): /* Jan 2 is Sat, not leap.  */
+    case PACK (1, 0, 0): /* Jan 2 is Sun, not leap.  */
+    case PACK (1, 6, 1): /* Jan 2 is Sat, leap year.  */
+    case PACK (1, 0, 1): /* Jan 2 is Sun, leap year.  */
+    case PACK (2, 0, 0): /* Jan 3 is Sun, not leap.  */
+    case PACK (2, 0, 1): /* Jan 3 is Sun, leap year.  */
+      return -1; /* Belongs to last week of previous year.  */
+    case PACK (362, 1, 0): /* Dec 29 is Mon, not leap.  */
+    case PACK (363, 1, 1): /* Dec 29 is Mon, leap year.  */
+    case PACK (363, 1, 0): /* Dec 30 is Mon, not leap.  */
+    case PACK (363, 2, 0): /* Dec 30 is Tue, not leap.  */
+    case PACK (364, 1, 1): /* Dec 30 is Mon, leap year.  */
+    case PACK (364, 2, 1): /* Dec 30 is Tue, leap year.  */
+    case PACK (364, 1, 0): /* Dec 31 is Mon, not leap.  */
+    case PACK (364, 2, 0): /* Dec 31 is Tue, not leap.  */
+    case PACK (364, 3, 0): /* Dec 31 is Wed, not leap.  */
+    case PACK (365, 1, 1): /* Dec 31 is Mon, leap year.  */
+    case PACK (365, 2, 1): /* Dec 31 is Tue, leap year.  */
+    case PACK (365, 3, 1): /* Dec 31 is Wed, leap year.  */
+      return 1; /* Belongs to first week of next year.  */
+    }
+  return 0; /* Belongs to specified year.  */
+#undef PACK
+}
+
+#ifdef _WANT_C99_TIME_FORMATS
+typedef struct {
+  int   year;
+  CHAR *era_C;
+  CHAR *era_Y;
+} era_info_t;
+
+static era_info_t *
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+get_era_info (const struct tm *tim_p, const wchar_t *era)
+#else
+get_era_info (const struct tm *tim_p, const char *era)
+#endif
+{
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  wchar_t *c;
+  const wchar_t *dir;
+# define ERA_STRCHR(a,b)	wcschr((a),(b))
+# define ERA_STRNCPY(a,b,c)	wcsncpy((a),(b),(c))
+# define ERA_STRTOL(a,b,c)	wcstol((a),(b),(c))
+#else
+  char *c;
+  const char *dir;
+# define ERA_STRCHR(a,b)	strchr((a),(b))
+# define ERA_STRNCPY(a,b,c)	strncpy((a),(b),(c))
+# define ERA_STRTOL(a,b,c)	strtol((a),(b),(c))
+#endif
+  long offset;
+  struct tm stm, etm;
+  era_info_t *ei;
+
+  ei = (era_info_t *) calloc (1, sizeof (era_info_t));
+  if (!ei)
+    return NULL;
+
+  stm.tm_isdst = etm.tm_isdst = 0;
+  while (era)
+    {
+      dir = era;
+      era += 2;
+      offset = ERA_STRTOL (era, &c, 10);
+      era = c + 1;
+      stm.tm_year = ERA_STRTOL (era, &c, 10) - YEAR_BASE;
+      /* Adjust offset for negative gregorian dates. */
+      if (stm.tm_year <= -YEAR_BASE)
+      	++stm.tm_year;
+      stm.tm_mon = ERA_STRTOL (c + 1, &c, 10) - 1;
+      stm.tm_mday = ERA_STRTOL (c + 1, &c, 10);
+      stm.tm_hour = stm.tm_min = stm.tm_sec = 0;
+      era = c + 1;
+      if (era[0] == '-' && era[1] == '*')
+      	{
+	  etm = stm;
+	  stm.tm_year = INT_MIN;
+	  stm.tm_mon = stm.tm_mday = stm.tm_hour = stm.tm_min = stm.tm_sec = 0;
+	  era += 3;
+	}
+      else if (era[0] == '+' && era[1] == '*')
+	{
+	  etm.tm_year = INT_MAX;
+	  etm.tm_mon = 11;
+	  etm.tm_mday = 31;
+	  etm.tm_hour = 23;
+	  etm.tm_min = etm.tm_sec = 59;
+	  era += 3;
+	}
+      else
+      	{
+	  etm.tm_year = ERA_STRTOL (era, &c, 10) - YEAR_BASE;
+	  /* Adjust offset for negative gregorian dates. */
+	  if (etm.tm_year <= -YEAR_BASE)
+	    ++etm.tm_year;
+	  etm.tm_mon = ERA_STRTOL (c + 1, &c, 10) - 1;
+	  etm.tm_mday = ERA_STRTOL (c + 1, &c, 10);
+	  etm.tm_mday = 31;
+	  etm.tm_hour = 23;
+	  etm.tm_min = etm.tm_sec = 59;
+	  era = c + 1;
+	}
+      if ((tim_p->tm_year > stm.tm_year
+	   || (tim_p->tm_year == stm.tm_year
+	       && (tim_p->tm_mon > stm.tm_mon
+		   || (tim_p->tm_mon == stm.tm_mon
+		       && tim_p->tm_mday >= stm.tm_mday))))
+	  && (tim_p->tm_year < etm.tm_year
+	      || (tim_p->tm_year == etm.tm_year
+		  && (tim_p->tm_mon < etm.tm_mon
+		      || (tim_p->tm_mon == etm.tm_mon
+			  && tim_p->tm_mday <= etm.tm_mday)))))
+	{
+	  /* Gotcha */
+	  size_t len;
+
+	  /* year */
+	  if (*dir == '+' && stm.tm_year != INT_MIN)
+	    ei->year = tim_p->tm_year - stm.tm_year + offset;
+	  else
+	    ei->year = etm.tm_year - tim_p->tm_year + offset;
+	  /* era_C */
+	  c = ERA_STRCHR (era, ':');
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (NULL, &era, c - era, 0, NULL);
+	  if (len == (size_t) -1)
+	    {
+	      free (ei);
+	      return NULL;
+	    }
+#else
+	  len = c - era;
+#endif
+	  ei->era_C = (CHAR *) malloc ((len + 1) * sizeof (CHAR));
+	  if (!ei->era_C)
+	    {
+	      free (ei);
+	      return NULL;
+	    }
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (ei->era_C, &era, c - era, len + 1, NULL);
+#else
+	  ERA_STRNCPY (ei->era_C, era, len);
+	  era += len;
+#endif
+	  ei->era_C[len] = CQ('\0');
+	  /* era_Y */
+	  ++era;
+	  c = ERA_STRCHR (era, ';');
+	  if (!c)
+	    c = ERA_STRCHR (era, '\0');
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (NULL, &era, c - era, 0, NULL);
+	  if (len == (size_t) -1)
+	    {
+	      free (ei->era_C);
+	      free (ei);
+	      return NULL;
+	    }
+#else
+	  len = c - era;
+#endif
+	  ei->era_Y = (CHAR *) malloc ((len + 1) * sizeof (CHAR));
+	  if (!ei->era_Y)
+	    {
+	      free (ei->era_C);
+	      free (ei);
+	      return NULL;
+	    }
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (ei->era_Y, &era, c - era, len + 1, NULL);
+#else
+	  ERA_STRNCPY (ei->era_Y, era, len);
+	  era += len;
+#endif
+	  ei->era_Y[len] = CQ('\0');
+	  return ei;
+	}
+      else
+	era = ERA_STRCHR (era, ';');
+      if (era)
+	++era;
+    }
+  return NULL;
+}
+
+static void
+free_era_info (era_info_t *ei)
+{
+  free (ei->era_C);
+  free (ei->era_Y);
+  free (ei);
+}
+
+typedef struct {
+  size_t num;
+  CHAR **digit;
+  CHAR *buffer;
+} alt_digits_t;
+
+static alt_digits_t *
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+get_alt_digits (const wchar_t *alt_digits)
+#else
+get_alt_digits (const char *alt_digits)
+#endif
+{
+  alt_digits_t *adi;
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  const wchar_t *a, *e;
+# define ALT_STRCHR(a,b)	wcschr((a),(b))
+# define ALT_STRCPY(a,b)	wcscpy((a),(b))
+# define ALT_STRLEN(a)		wcslen(a)
+#else
+  const char *a, *e;
+# define ALT_STRCHR(a,b)	strchr((a),(b))
+# define ALT_STRCPY(a,b)	strcpy((a),(b))
+# define ALT_STRLEN(a)		strlen(a)
+#endif
+  CHAR *aa, *ae;
+  size_t len;
+
+  adi = (alt_digits_t *) calloc (1, sizeof (alt_digits_t));
+  if (!adi)
+    return NULL;
+
+  /* Compute number of alt_digits. */
+  adi->num = 1;
+  for (a = alt_digits; (e = ALT_STRCHR (a, ';')) != NULL; a = e + 1)
+      ++adi->num;
+  /* Allocate the `digit' array, which is an array of `num' pointers into
+     `buffer'. */
+  adi->digit = (CHAR **) calloc (adi->num, sizeof (CHAR **));
+  if (!adi->digit)
+    {
+      free (adi);
+      return NULL;
+    }
+  /* Compute memory required for `buffer'. */
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  len = mbstowcs (NULL, alt_digits, 0);
+  if (len == (size_t) -1)
+    {
+      free (adi->digit);
+      free (adi);
+      return NULL;
+    }
+#else
+  len = ALT_STRLEN (alt_digits);
+#endif
+  /* Allocate it. */
+  adi->buffer = (CHAR *) malloc ((len + 1) * sizeof (CHAR));
+  if (!adi->buffer)
+    {
+      free (adi->digit);
+      free (adi);
+      return NULL;
+    }
+  /* Store digits in it. */
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  mbstowcs (adi->buffer, alt_digits, len + 1);
+#else
+  ALT_STRCPY (adi->buffer, alt_digits);
+#endif
+  /* Store the pointers into `buffer' into the appropriate `digit' slot. */
+  for (len = 0, aa = adi->buffer; (ae = STRCHR (aa, CQ(';'))) != NULL;
+       ++len, aa = ae + 1)
+    {
+      *ae = '\0';
+      adi->digit[len] = aa;
+    }
+  adi->digit[len] = aa;
+  return adi;
+}
+
+static void
+free_alt_digits (alt_digits_t *adi)
+{
+  free (adi->digit);
+  free (adi->buffer);
+  free (adi);
+}
+
+/* Return 0 if no alt_digit is available for a number.
+   Return -1 if buffer size isn't sufficient to hold alternative digit.
+   Return length of new digit otherwise. */
+static int
+conv_to_alt_digits (CHAR *buf, size_t bufsiz, unsigned num, alt_digits_t *adi)
+{
+  if (num < adi->num)
+    {
+      size_t len = STRLEN (adi->digit[num]);
+      if (bufsiz < len)
+      	return -1;
+      STRCPY (buf, adi->digit[num]);
+      return (int) len;
+    }
+  return 0;
+}
+
+static size_t __strftime (CHAR *, size_t, const CHAR *, const struct tm *,
+			  era_info_t **, alt_digits_t **);
+
+size_t
+_DEFUN (strftime, (s, maxsize, format, tim_p),
+	CHAR *__restrict s _AND
+	size_t maxsize _AND
+	_CONST CHAR *__restrict format _AND
+	_CONST struct tm *__restrict tim_p)
+{
+  era_info_t *era_info = NULL;
+  alt_digits_t *alt_digits = NULL;
+  size_t ret = __strftime (s, maxsize, format, tim_p, &era_info, &alt_digits);
+  if (era_info)
+    free_era_info (era_info);
+  if (alt_digits)
+    free_alt_digits (alt_digits);
+  return ret;
+}
+
+static size_t
+__strftime (CHAR *s, size_t maxsize, const CHAR *format,
+	    const struct tm *tim_p, era_info_t **era_info,
+	    alt_digits_t **alt_digits)
+#else /* !_WANT_C99_TIME_FORMATS */
+# define __strftime(s,m,f,t,e,a)	strftime((s),(m),(f),(t))
+
+size_t
+_DEFUN (strftime, (s, maxsize, format, tim_p),
+	CHAR *__restrict s _AND
+	size_t maxsize _AND
+	_CONST CHAR *__restrict format _AND
+	_CONST struct tm *__restrict tim_p)
+#endif /* !_WANT_C99_TIME_FORMATS */
+{
+  size_t count = 0;
+  int len = 0;
+  const CHAR *ctloc;
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  CHAR ctlocbuf[CTLOCBUFLEN];
+#endif
+  size_t i, ctloclen;
+  CHAR alt;
+  CHAR pad;
+  unsigned long width;
+  int tzset_called = 0;
+
+  struct lc_time_T *_CurrentTimeLocale = __get_current_time_locale ();
+  for (;;)
+    {
+      while (*format && *format != CQ('%'))
+	{
+	  if (count < maxsize - 1)
+	    s[count++] = *format++;
+	  else
+	    return 0;
+	}
+      if (*format == CQ('\0'))
+	break;
+      format++;
+      pad = '\0';
+      width = 0;
+
+      /* POSIX-1.2008 feature: '0' and '+' modifiers require 0-padding with
+         slightly different semantics. */
+      if (*format == CQ('0') || *format == CQ('+'))
+	pad = *format++;
+
+      /* POSIX-1.2008 feature: A minimum field width can be specified. */
+      if (*format >= CQ('1') && *format <= CQ('9'))
+      	{
+	  CHAR *fp;
+	  width = STRTOUL (format, &fp, 10);
+	  format = fp;
+	}
+
+      alt = CQ('\0');
+      if (*format == CQ('E'))
+	{
+	  alt = *format++;
+#ifdef _WANT_C99_TIME_FORMATS
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  if (!*era_info && *_CurrentTimeLocale->wera)
+	    *era_info = get_era_info (tim_p, _CurrentTimeLocale->wera);
+#else
+	  if (!*era_info && *_CurrentTimeLocale->era)
+	    *era_info = get_era_info (tim_p, _CurrentTimeLocale->era);
+#endif
+#endif /* _WANT_C99_TIME_FORMATS */
+	}
+      else if (*format == CQ('O'))
+	{
+	  alt = *format++;
+#ifdef _WANT_C99_TIME_FORMATS
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  if (!*alt_digits && *_CurrentTimeLocale->walt_digits)
+	    *alt_digits = get_alt_digits (_CurrentTimeLocale->walt_digits);
+#else
+	  if (!*alt_digits && *_CurrentTimeLocale->alt_digits)
+	    *alt_digits = get_alt_digits (_CurrentTimeLocale->alt_digits);
+#endif
+#endif /* _WANT_C99_TIME_FORMATS */
+	}
+
+      switch (*format)
+	{
+	case CQ('a'):
+	  _ctloc (wday[tim_p->tm_wday]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('A'):
+	  _ctloc (weekday[tim_p->tm_wday]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('b'):
+	case CQ('h'):
+	  _ctloc (mon[tim_p->tm_mon]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('B'):
+	  _ctloc (month[tim_p->tm_mon]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('c'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info && *_CurrentTimeLocale->era_d_t_fmt)
+	    _ctloc (era_d_t_fmt);
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    _ctloc (c_fmt);
+	  goto recurse;
+	case CQ('r'):
+	  _ctloc (ampm_fmt);
+	  goto recurse;
+	case CQ('x'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info && *_CurrentTimeLocale->era_d_fmt)
+	    _ctloc (era_d_fmt);
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    _ctloc (x_fmt);
+	  goto recurse;
+	case CQ('X'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info && *_CurrentTimeLocale->era_t_fmt)
+	    _ctloc (era_t_fmt);
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    _ctloc (X_fmt);
+recurse:
+	  if (*ctloc)
+	    {
+	      /* Recurse to avoid need to replicate %Y formation. */
+	      len = __strftime (&s[count], maxsize - count, ctloc, tim_p,
+				era_info, alt_digits);
+	      if (len > 0)
+		count += len;
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('C'):
+	  {
+	    /* Examples of (tm_year + YEAR_BASE) that show how %Y == %C%y
+	       with 32-bit int.
+	       %Y		%C		%y
+	       2147485547	21474855	47
+	       10000		100		00
+	       9999		99		99
+	       0999		09		99
+	       0099		00		99
+	       0001		00		01
+	       0000		00		00
+	       -001		-0		01
+	       -099		-0		99
+	       -999		-9		99
+	       -1000		-10		00
+	       -10000		-100		00
+	       -2147481748	-21474817	48
+
+	       Be careful of both overflow and sign adjustment due to the
+	       asymmetric range of years.
+	    */
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt == 'E' && *era_info)
+	      len = snprintf (&s[count], maxsize - count, CQ("%" SFLG "s"),
+			      (*era_info)->era_C);
+	    else
+#endif /* _WANT_C99_TIME_FORMATS */
+	      {
+		CHAR *fmt = CQ("%s%.*d");
+		char *pos = "";
+		int neg = tim_p->tm_year < -YEAR_BASE;
+		int century = tim_p->tm_year >= 0
+		  ? tim_p->tm_year / 100 + YEAR_BASE / 100
+		  : abs (tim_p->tm_year + YEAR_BASE) / 100;
+		if (pad) /* '0' or '+' */
+		  {
+		    fmt = CQ("%s%0.*d");
+		    if (century >= 100 && pad == CQ('+'))
+		      pos = "+";
+		  }
+		if (width < 2)
+		  width = 2;
+		len = snprintf (&s[count], maxsize - count, fmt,
+				neg ? "-" : pos, width - neg, century);
+	      }
+            CHECK_LENGTH ();
+	  }
+	  break;
+	case CQ('d'):
+	case CQ('e'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      if (tim_p->tm_mday < 10)
+	      	{
+		  if (*format == CQ('d'))
+		    {
+		      if (maxsize - count < 2) return 0;
+		      len = conv_to_alt_digits (&s[count], maxsize - count,
+						0, *alt_digits);
+		      CHECK_LENGTH ();
+		    }
+		  if (*format == CQ('e') || len == 0)
+		    s[count++] = CQ(' ');
+		}
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_mday, *alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+	  len = snprintf (&s[count], maxsize - count,
+			  *format == CQ('d') ? CQ("%.2d") : CQ("%2d"),
+			  tim_p->tm_mday);
+	  CHECK_LENGTH ();
+	  break;
+	case CQ('D'):
+	  /* %m/%d/%y */
+	  len = snprintf (&s[count], maxsize - count,
+			  CQ("%.2d/%.2d/%.2d"),
+			  tim_p->tm_mon + 1, tim_p->tm_mday,
+			  tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+			  : abs (tim_p->tm_year + YEAR_BASE) % 100);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('F'):
+	  { /* %F is equivalent to "%+4Y-%m-%d", flags and width can change
+	       that.  Recurse to avoid need to replicate %Y formation. */
+	    CHAR fmtbuf[32], *fmt = fmtbuf;
+	
+	    *fmt++ = CQ('%');
+	    if (pad) /* '0' or '+' */
+	      *fmt++ = pad;
+	    else
+	      *fmt++ = '+';
+	    if (!pad)
+	      width = 10;
+	    if (width < 6)
+	      width = 6;
+	    width -= 6;
+	    if (width)
+	      {
+		len = snprintf (fmt, fmtbuf + 32 - fmt, CQ("%lu"), width);
+		if (len > 0)
+		  fmt += len;
+	      }
+	    STRCPY (fmt, CQ("Y-%m-%d"));
+	    len = __strftime (&s[count], maxsize - count, fmtbuf, tim_p,
+			      era_info, alt_digits);
+	    if (len > 0)
+	      count += len;
+	    else
+	      return 0;
+	  }
+          break;
+	case CQ('g'):
+	  /* Be careful of both overflow and negative years, thanks to
+		 the asymmetric range of years.  */
+	  {
+	    int adjust = iso_year_adjust (tim_p);
+	    int year = tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+		: abs (tim_p->tm_year + YEAR_BASE) % 100;
+	    if (adjust < 0 && tim_p->tm_year <= -YEAR_BASE)
+		adjust = 1;
+	    else if (adjust > 0 && tim_p->tm_year < -YEAR_BASE)
+		adjust = -1;
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    ((year + adjust) % 100 + 100) % 100);
+            CHECK_LENGTH ();
+	  }
+          break;
+	case CQ('G'):
+	  {
+	    /* See the comments for 'C' and 'Y'; this is a variable length
+	       field.  Although there is no requirement for a minimum number
+	       of digits, we use 4 for consistency with 'Y'.  */
+	    int sign = tim_p->tm_year < -YEAR_BASE;
+	    int adjust = iso_year_adjust (tim_p);
+	    int century = tim_p->tm_year >= 0
+	      ? tim_p->tm_year / 100 + YEAR_BASE / 100
+	      : abs (tim_p->tm_year + YEAR_BASE) / 100;
+	    int year = tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+	      : abs (tim_p->tm_year + YEAR_BASE) % 100;
+	    if (adjust < 0 && tim_p->tm_year <= -YEAR_BASE)
+	      sign = adjust = 1;
+	    else if (adjust > 0 && sign)
+	      adjust = -1;
+	    year += adjust;
+	    if (year == -1)
+	      {
+		year = 99;
+		--century;
+	      }
+	    else if (year == 100)
+	      {
+		year = 0;
+		++century;
+	      }
+	    CHAR fmtbuf[10], *fmt = fmtbuf;
+	    /* int potentially overflows, so use unsigned instead.  */
+	    unsigned p_year = century * 100 + year;
+	    if (sign)
+	      *fmt++ = CQ('-');
+	    else if (pad == CQ('+') && p_year >= 10000)
+	      {
+		*fmt++ = CQ('+');
+		sign = 1;
+	      }
+	    if (width && sign)
+	      --width;
+	    *fmt++ = CQ('%');
+	    if (pad)
+	      *fmt++ = CQ('0');
+	    STRCPY (fmt, CQ(".*u"));
+	    len = snprintf (&s[count], maxsize - count, fmtbuf, width, p_year);
+            if (len < 0  ||  (count+=len) >= maxsize)
+              return 0;
+	  }
+          break;
+	case CQ('H'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_hour, *alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+	  /*FALLTHRU*/
+	case CQ('k'):	/* newlib extension */
+	  len = snprintf (&s[count], maxsize - count,
+			  *format == CQ('k') ? CQ("%2d") : CQ("%.2d"),
+			  tim_p->tm_hour);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('l'):	/* newlib extension */
+	  if (alt == CQ('O'))
+	    alt = CQ('\0');
+	  /*FALLTHRU*/
+	case CQ('I'):
+	  {
+	    register int  h12;
+	    h12 = (tim_p->tm_hour == 0 || tim_p->tm_hour == 12)  ?
+						12  :  tim_p->tm_hour % 12;
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt != CQ('O') || !*alt_digits
+		|| !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					       h12, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	      len = snprintf (&s[count], maxsize - count,
+			      *format == CQ('I') ? CQ("%.2d") : CQ("%2d"), h12);
+	    CHECK_LENGTH ();
+	  }
+	  break;
+	case CQ('j'):
+	  len = snprintf (&s[count], maxsize - count, CQ("%.3d"),
+			  tim_p->tm_yday + 1);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('m'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     tim_p->tm_mon + 1, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    tim_p->tm_mon + 1);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('M'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     tim_p->tm_min, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    tim_p->tm_min);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('n'):
+	  if (count < maxsize - 1)
+	    s[count++] = CQ('\n');
+	  else
+	    return 0;
+	  break;
+	case CQ('p'):
+	case CQ('P'):
+	  _ctloc (am_pm[tim_p->tm_hour < 12 ? 0 : 1]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = (*format == CQ('P') ? TOLOWER (ctloc[i])
+						 : ctloc[i]);
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('R'):
+          len = snprintf (&s[count], maxsize - count, CQ("%.2d:%.2d"),
+			  tim_p->tm_hour, tim_p->tm_min);
+          CHECK_LENGTH ();
+          break;
+	case CQ('s'):
+/*
+ * From:
+ * The Open Group Base Specifications Issue 7
+ * IEEE Std 1003.1, 2013 Edition
+ * Copyright (c) 2001-2013 The IEEE and The Open Group
+ * XBD Base Definitions
+ * 4. General Concepts
+ * 4.15 Seconds Since the Epoch
+ * A value that approximates the number of seconds that have elapsed since the
+ * Epoch. A Coordinated Universal Time name (specified in terms of seconds
+ * (tm_sec), minutes (tm_min), hours (tm_hour), days since January 1 of the year
+ * (tm_yday), and calendar year minus 1900 (tm_year)) is related to a time
+ * represented as seconds since the Epoch, according to the expression below.
+ * If the year is <1970 or the value is negative, the relationship is undefined.
+ * If the year is >=1970 and the value is non-negative, the value is related to a
+ * Coordinated Universal Time name according to the C-language expression, where
+ * tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all integer types:
+ * tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
+ *     (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
+ *     ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
+ * OR
+ * ((((tm_year-69)/4 - (tm_year-1)/100 + (tm_year+299)/400 +
+ *         (tm_year-70)*365 + tm_yday)*24 + tm_hour)*60 + tm_min)*60 + tm_sec
+ */
+/* modified from %z case by hoisting offset outside if block and initializing */
+	  {
+	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
+	    offset = 0;	   subtract to get UTC */
+
+	    if (tim_p->tm_isdst >= 0)
+	      {
+		TZ_LOCK;
+		if (!tzset_called)
+		  {
+		    _tzset_unlocked ();
+		    tzset_called = 1;
+		  }
+
+#if defined (__CYGWIN__)
+		/* Cygwin must check if the application has been built with or
+		   without the extra tm members for backward compatibility, and
+		   then use either that or the old method fetching from tzinfo.
+		   Rather than pulling in the version check infrastructure, we
+		   just call a Cygwin function. */
+		extern long __cygwin_gettzoffset (const struct tm *tmp);
+		offset = __cygwin_gettzoffset (tim_p);
+#elif defined (__TM_GMTOFF)
+		offset = tim_p->__TM_GMTOFF;
+#else
+		__tzinfo_type *tz = __gettzinfo ();
+		/* The sign of this is exactly opposite the envvar TZ.  We
+		   could directly use the global _timezone for tm_isdst==0,
+		   but have to use __tzrule for daylight savings.  */
+		offset = -tz->__tzrule[tim_p->tm_isdst > 0].offset;
+#endif
+		TZ_UNLOCK;
+	      }
+	    len = snprintf (&s[count], maxsize - count, CQ("%lld"),
+			    (((((long long)tim_p->tm_year - 69)/4
+				- (tim_p->tm_year - 1)/100
+				+ (tim_p->tm_year + 299)/400
+				+ (tim_p->tm_year - 70)*365 + tim_p->tm_yday)*24
+			      + tim_p->tm_hour)*60 + tim_p->tm_min)*60
+			    + tim_p->tm_sec - offset);
+	    CHECK_LENGTH ();
+	  }
+          break;
+	case CQ('S'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     tim_p->tm_sec, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    tim_p->tm_sec);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('t'):
+	  if (count < maxsize - 1)
+	    s[count++] = CQ('\t');
+	  else
+	    return 0;
+	  break;
+	case CQ('T'):
+          len = snprintf (&s[count], maxsize - count, CQ("%.2d:%.2d:%.2d"),
+			  tim_p->tm_hour, tim_p->tm_min, tim_p->tm_sec);
+          CHECK_LENGTH ();
+          break;
+	case CQ('u'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_wday == 0 ? 7
+							    : tim_p->tm_wday,
+					*alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+          if (count < maxsize - 1)
+            {
+              if (tim_p->tm_wday == 0)
+                s[count++] = CQ('7');
+              else
+                s[count++] = CQ('0') + tim_p->tm_wday;
+            }
+          else
+            return 0;
+          break;
+	case CQ('U'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     (tim_p->tm_yday + 7 -
+					      tim_p->tm_wday) / 7,
+					     *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			 (tim_p->tm_yday + 7 -
+			  tim_p->tm_wday) / 7);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('V'):
+	  {
+	    int adjust = iso_year_adjust (tim_p);
+	    int wday = (tim_p->tm_wday) ? tim_p->tm_wday - 1 : 6;
+	    int week = (tim_p->tm_yday + 10 - wday) / 7;
+	    if (adjust > 0)
+		week = 1;
+	    else if (adjust < 0)
+		/* Previous year has 53 weeks if current year starts on
+		   Fri, and also if current year starts on Sat and
+		   previous year was leap year.  */
+		week = 52 + (4 >= (wday - tim_p->tm_yday
+				   - isleap (tim_p->tm_year
+					     + (YEAR_BASE - 1
+						- (tim_p->tm_year < 0
+						   ? 0 : 2000)))));
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt != CQ('O') || !*alt_digits
+		|| !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					       week, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	      len = snprintf (&s[count], maxsize - count, CQ("%.2d"), week);
+            CHECK_LENGTH ();
+	  }
+          break;
+	case CQ('w'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_wday, *alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+	  if (count < maxsize - 1)
+            s[count++] = CQ('0') + tim_p->tm_wday;
+	  else
+	    return 0;
+	  break;
+	case CQ('W'):
+	  {
+	    int wday = (tim_p->tm_wday) ? tim_p->tm_wday - 1 : 6;
+	    wday = (tim_p->tm_yday + 7 - wday) / 7;
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt != CQ('O') || !*alt_digits
+		|| !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					       wday, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	      len = snprintf (&s[count], maxsize - count, CQ("%.2d"), wday);
+            CHECK_LENGTH ();
+	  }
+	  break;
+	case CQ('y'):
+	    {
+#ifdef _WANT_C99_TIME_FORMATS
+	      if (alt == 'E' && *era_info)
+		len = snprintf (&s[count], maxsize - count, CQ("%d"),
+				(*era_info)->year);
+	      else
+#endif /* _WANT_C99_TIME_FORMATS */
+		{
+		  /* Be careful of both overflow and negative years, thanks to
+		     the asymmetric range of years.  */
+		  int year = tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+			     : abs (tim_p->tm_year + YEAR_BASE) % 100;
+#ifdef _WANT_C99_TIME_FORMATS
+		  if (alt != CQ('O') || !*alt_digits
+		      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+						     year, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+		    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+				    year);
+		}
+              CHECK_LENGTH ();
+	    }
+	  break;
+	case CQ('Y'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info)
+	    {
+	      ctloc = (*era_info)->era_Y;
+	      goto recurse;
+	    }
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    {
+	      CHAR fmtbuf[10], *fmt = fmtbuf;
+	      int sign = tim_p->tm_year < -YEAR_BASE;
+	      /* int potentially overflows, so use unsigned instead.  */
+	      register unsigned year = (unsigned) tim_p->tm_year
+				       + (unsigned) YEAR_BASE;
+	      if (sign)
+		{
+		  *fmt++ = CQ('-');
+		  year = UINT_MAX - year + 1;
+		}
+	      else if (pad == CQ('+') && year >= 10000)
+		{
+		  *fmt++ = CQ('+');
+		  sign = 1;
+		}
+	      if (width && sign)
+		--width;
+	      *fmt++ = CQ('%');
+	      if (pad)
+		*fmt++ = CQ('0');
+	      STRCPY (fmt, CQ(".*u"));
+	      len = snprintf (&s[count], maxsize - count, fmtbuf, width,
+			      year);
+	      CHECK_LENGTH ();
+	    }
+	  break;
+	case CQ('z'):
+          if (tim_p->tm_isdst >= 0)
+            {
+	      long offset;
+
+	      TZ_LOCK;
+	      if (!tzset_called)
+		{
+		  _tzset_unlocked ();
+		  tzset_called = 1;
+		}
+
+#if defined (__CYGWIN__)
+	      /* Cygwin must check if the application has been built with or
+		 without the extra tm members for backward compatibility, and
+		 then use either that or the old method fetching from tzinfo.
+		 Rather than pulling in the version check infrastructure, we
+		 just call a Cygwin function. */
+	      extern long __cygwin_gettzoffset (const struct tm *tmp);
+	      offset = __cygwin_gettzoffset (tim_p);
+#elif defined (__TM_GMTOFF)
+	      offset = tim_p->__TM_GMTOFF;
+#else
+	      __tzinfo_type *tz = __gettzinfo ();
+	      /* The sign of this is exactly opposite the envvar TZ.  We
+		 could directly use the global _timezone for tm_isdst==0,
+		 but have to use __tzrule for daylight savings.  */
+	      offset = -tz->__tzrule[tim_p->tm_isdst > 0].offset;
+#endif
+	      TZ_UNLOCK;
+	      len = snprintf (&s[count], maxsize - count, CQ("%+03ld%.2ld"),
+			      offset / SECSPERHOUR,
+			      labs (offset / SECSPERMIN) % 60L);
+              CHECK_LENGTH ();
+            }
+          break;
+	case CQ('Z'):
+	  if (tim_p->tm_isdst >= 0)
+	    {
+	      size_t size;
+	      const char *tznam = NULL;
+
+	      TZ_LOCK;
+	      if (!tzset_called)
+		{
+		  _tzset_unlocked ();
+		  tzset_called = 1;
+		}
+#if defined (__CYGWIN__)
+	      /* See above. */
+	      extern const char *__cygwin_gettzname (const struct tm *tmp);
+	      tznam = __cygwin_gettzname (tim_p);
+#elif defined (__TM_ZONE)
+	      tznam = tim_p->__TM_ZONE;
+#endif
+	      if (!tznam)
+		tznam = _tzname[tim_p->tm_isdst > 0];
+	      /* Note that in case of wcsftime this loop only works for
+	         timezone abbreviations using the portable codeset (aka ASCII).
+		 This seems to be the case, but if that ever changes, this
+		 loop needs revisiting. */
+	      size = strlen (tznam);
+	      for (i = 0; i < size; i++)
+		{
+		  if (count < maxsize - 1)
+		    s[count++] = tznam[i];
+		  else
+		    {
+		      TZ_UNLOCK;
+		      return 0;
+		    }
+		}
+	      TZ_UNLOCK;
+	    }
+	  break;
+	case CQ('%'):
+	  if (count < maxsize - 1)
+	    s[count++] = CQ('%');
+	  else
+	    return 0;
+	  break;
+	default:
+	  return 0;
+	}
+      if (*format)
+	format++;
+      else
+	break;
+    }
+  if (maxsize)
+    s[count] = CQ('\0');
+
+  return count;
+}
+
+/* The remainder of this file can serve as a regression test.  Compile
+ *  with -D_REGRESSION_TEST.  */
+#if defined(_REGRESSION_TEST)	/* [Test code:  */
+
+/* This test code relies on ANSI C features, in particular on the ability
+ * of adjacent strings to be pasted together into one string.  */
+
+/* Test output buffer size (should be larger than all expected results) */
+#define OUTSIZE	256
+
+struct test {
+	CHAR  *fmt;	/* Testing format */
+	size_t  max;	/* Testing maxsize */
+	size_t	ret;	/* Expected return value */
+	CHAR  *out;	/* Expected output string */
+	};
+struct list {
+	const struct tm  *tms;	/* Time used for these vectors */
+	const struct test *vec;	/* Test vectors */
+	int  cnt;		/* Number of vectors */
+	};
+
+const char  TZ[]="TZ=EST5EDT";
+
+/* Define list of test inputs and expected outputs, for the given time zone
+ * and time.  */
+const struct tm  tm0 = {
+	/* Tue Dec 30 10:53:47 EST 2008 (time_t=1230648827) */
+	.tm_sec 	= 47,
+	.tm_min 	= 53,
+	.tm_hour	= 9,
+	.tm_mday	= 30,
+	.tm_mon 	= 11,
+	.tm_year	= 108,
+	.tm_wday	= 2,
+	.tm_yday	= 364,
+	.tm_isdst	= 0
+	};
+const struct test  Vec0[] = {
+	/* Testing fields one at a time, expecting to pass, using exact
+	 * allowed length as what is needed.  */
+	/* Using tm0 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%a"), 3+1, EXP(CQ("Tue")) },
+	{ CQ("%A"), 7+1, EXP(CQ("Tuesday")) },
+	{ CQ("%b"), 3+1, EXP(CQ("Dec")) },
+	{ CQ("%B"), 8+1, EXP(CQ("December")) },
+	{ CQ("%c"), 24+1, EXP(CQ("Tue Dec 30 09:53:47 2008")) },
+	{ CQ("%C"), 2+1, EXP(CQ("20")) },
+	{ CQ("%d"), 2+1, EXP(CQ("30")) },
+	{ CQ("%D"), 8+1, EXP(CQ("12/30/08")) },
+	{ CQ("%e"), 2+1, EXP(CQ("30")) },
+	{ CQ("%F"), 10+1, EXP(CQ("2008-12-30")) },
+	{ CQ("%g"), 2+1, EXP(CQ("09")) },
+	{ CQ("%G"), 4+1, EXP(CQ("2009")) },
+	{ CQ("%h"), 3+1, EXP(CQ("Dec")) },
+	{ CQ("%H"), 2+1, EXP(CQ("09")) },
+	{ CQ("%I"), 2+1, EXP(CQ("09")) },
+	{ CQ("%j"), 3+1, EXP(CQ("365")) },
+	{ CQ("%k"), 2+1, EXP(CQ(" 9")) },
+	{ CQ("%l"), 2+1, EXP(CQ(" 9")) },
+	{ CQ("%m"), 2+1, EXP(CQ("12")) },
+	{ CQ("%M"), 2+1, EXP(CQ("53")) },
+	{ CQ("%n"), 1+1, EXP(CQ("\n")) },
+	{ CQ("%p"), 2+1, EXP(CQ("AM")) },
+	{ CQ("%r"), 11+1, EXP(CQ("09:53:47 AM")) },
+	{ CQ("%R"), 5+1, EXP(CQ("09:53")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1230648827")) },
+	{ CQ("%S"), 2+1, EXP(CQ("47")) },
+	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
+	{ CQ("%T"), 8+1, EXP(CQ("09:53:47")) },
+	{ CQ("%u"), 1+1, EXP(CQ("2")) },
+	{ CQ("%U"), 2+1, EXP(CQ("52")) },
+	{ CQ("%V"), 2+1, EXP(CQ("01")) },
+	{ CQ("%w"), 1+1, EXP(CQ("2")) },
+	{ CQ("%W"), 2+1, EXP(CQ("52")) },
+	{ CQ("%x"), 8+1, EXP(CQ("12/30/08")) },
+	{ CQ("%X"), 8+1, EXP(CQ("09:53:47")) },
+	{ CQ("%y"), 2+1, EXP(CQ("08")) },
+	{ CQ("%Y"), 4+1, EXP(CQ("2008")) },
+	{ CQ("%z"), 5+1, EXP(CQ("-0500")) },
+	{ CQ("%Z"), 3+1, EXP(CQ("EST")) },
+	{ CQ("%%"), 1+1, EXP(CQ("%")) },
+	#undef EXP
+	};
+/* Define list of test inputs and expected outputs, for the given time zone
+ * and time.  */
+const struct tm  tm1 = {
+	/* Wed Jul  2 23:01:13 EDT 2008 (time_t=1215054073) */
+	.tm_sec 	= 13,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= 108,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+const struct test  Vec1[] = {
+	/* Testing fields one at a time, expecting to pass, using exact
+	 * allowed length as what is needed.  */
+	/* Using tm1 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%a"), 3+1, EXP(CQ("Wed")) },
+	{ CQ("%A"), 9+1, EXP(CQ("Wednesday")) },
+	{ CQ("%b"), 3+1, EXP(CQ("Jul")) },
+	{ CQ("%B"), 4+1, EXP(CQ("July")) },
+	{ CQ("%c"), 24+1, EXP(CQ("Wed Jul  2 23:01:13 2008")) },
+	{ CQ("%C"), 2+1, EXP(CQ("20")) },
+	{ CQ("%d"), 2+1, EXP(CQ("02")) },
+	{ CQ("%D"), 8+1, EXP(CQ("07/02/08")) },
+	{ CQ("%e"), 2+1, EXP(CQ(" 2")) },
+	{ CQ("%F"), 10+1, EXP(CQ("2008-07-02")) },
+	{ CQ("%g"), 2+1, EXP(CQ("08")) },
+	{ CQ("%G"), 4+1, EXP(CQ("2008")) },
+	{ CQ("%h"), 3+1, EXP(CQ("Jul")) },
+	{ CQ("%H"), 2+1, EXP(CQ("23")) },
+	{ CQ("%I"), 2+1, EXP(CQ("11")) },
+	{ CQ("%j"), 3+1, EXP(CQ("184")) },
+	{ CQ("%k"), 2+1, EXP(CQ("23")) },
+	{ CQ("%l"), 2+1, EXP(CQ("11")) },
+	{ CQ("%m"), 2+1, EXP(CQ("07")) },
+	{ CQ("%M"), 2+1, EXP(CQ("01")) },
+	{ CQ("%n"), 1+1, EXP(CQ("\n")) },
+	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
+	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
+	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
+	{ CQ("%S"), 2+1, EXP(CQ("13")) },
+	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
+	{ CQ("%T"), 8+1, EXP(CQ("23:01:13")) },
+	{ CQ("%u"), 1+1, EXP(CQ("3")) },
+	{ CQ("%U"), 2+1, EXP(CQ("26")) },
+	{ CQ("%V"), 2+1, EXP(CQ("27")) },
+	{ CQ("%w"), 1+1, EXP(CQ("3")) },
+	{ CQ("%W"), 2+1, EXP(CQ("26")) },
+	{ CQ("%x"), 8+1, EXP(CQ("07/02/08")) },
+	{ CQ("%X"), 8+1, EXP(CQ("23:01:13")) },
+	{ CQ("%y"), 2+1, EXP(CQ("08")) },
+	{ CQ("%Y"), 4+1, EXP(CQ("2008")) },
+	{ CQ("%z"), 5+1, EXP(CQ("-0400")) },
+	{ CQ("%Z"), 3+1, EXP(CQ("EDT")) },
+	{ CQ("%%"), 1+1, EXP(CQ("%")) },
+	#undef EXP
+	#define VEC(s)	s, sizeof(s)/sizeof(CHAR), sizeof(s)/sizeof(CHAR)-1, s
+	#define EXP(s)	sizeof(s)/sizeof(CHAR), sizeof(s)/sizeof(CHAR)-1, s
+	{ VEC(CQ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) },
+	{ CQ("0123456789%%%h:`~"), EXP(CQ("0123456789%Jul:`~")) },
+	{ CQ("%R%h:`~ %x %w"), EXP(CQ("23:01Jul:`~ 07/02/08 3")) },
+	#undef VEC
+	#undef EXP
+	};
+
+#if YEAR_BASE == 1900  /* ( */
+/* Checks for very large years.  YEAR_BASE value relied upon so that the
+ * answer strings can be predetermined.
+ * Years more than 4 digits are not mentioned in the standard for %C, so the
+ * test for those cases are based on the design intent (which is to print the
+ * whole number, being the century).  */
+const struct tm  tmyr0 = {
+	/* Wed Jul  2 23:01:13 EDT [HUGE#] */
+	.tm_sec 	= 13,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= INT_MAX - YEAR_BASE/2,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#if INT_MAX == 32767
+#  define YEAR	CQ("33717")		/* INT_MAX + YEAR_BASE/2 */
+#  define CENT	CQ("337")
+#  define Year	   CQ("17")
+# elif INT_MAX == 2147483647
+#  define YEAR	CQ("2147484597")
+#  define CENT	CQ("21474845")
+#  define Year	        CQ("97")
+# elif INT_MAX == 9223372036854775807
+#  define YEAR	CQ("9223372036854776757")
+#  define CENT	CQ("92233720368547777")
+#  define Year	                 CQ("57")
+# else
+#  error "Unrecognized INT_MAX value:  enhance me to recognize what you have"
+#endif
+const struct test  Vecyr0[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyr0 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:13 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+/* Checks for very large negative years.  YEAR_BASE value relied upon so that
+ * the answer strings can be predetermined.  */
+const struct tm  tmyr1 = {
+	/* Wed Jul  2 23:01:13 EDT [HUGE#] */
+	.tm_sec 	= 13,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= INT_MIN,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#if INT_MAX == 32767
+#  define YEAR	CQ("-30868")		/* INT_MIN + YEAR_BASE */
+#  define CENT	CQ("-308")
+#  define Year	    CQ("68")
+# elif INT_MAX == 2147483647
+#  define YEAR	CQ("-2147481748")
+#  define CENT	CQ("-21474817")
+#  define Year	         CQ("48")
+# elif INT_MAX == 9223372036854775807
+#  define YEAR	CQ("-9223372036854773908")
+#  define CENT	CQ("-92233720368547739")
+#  define Year	                  CQ("08")
+# else
+#  error "Unrecognized INT_MAX value:  enhance me to recognize what you have"
+#endif
+const struct test  Vecyr1[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyr1 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:13 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+#endif /* YEAR_BASE ) */
+
+/* Checks for years just over zero (also test for s=60).
+ * Years less than 4 digits are not mentioned for %Y in the standard, so the
+ * test for that case is based on the design intent.  */
+const struct tm  tmyrzp = {
+	/* Wed Jul  2 23:01:60 EDT 0007 */
+	.tm_sec 	= 60,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= 7-YEAR_BASE,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#define YEAR	CQ("0007")	/* Design intent:  %Y=%C%y */
+#define CENT	CQ("00")
+#define Year	  CQ("07")
+const struct test  Vecyrzp[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyrzp for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:60 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+/* Checks for years just under zero.
+ * Negative years are not handled by the standard, so the vectors here are
+ * verifying the chosen implemtation.  */
+const struct tm  tmyrzn = {
+	/* Wed Jul  2 23:01:00 EDT -004 */
+	.tm_sec 	= 00,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= -4-YEAR_BASE,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#define YEAR	CQ("-004")
+#define CENT	CQ("-0")
+#define Year	  CQ("04")
+const struct test  Vecyrzn[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyrzn for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:00 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+
+const struct list  ListYr[] = {
+	{ &tmyrzp, Vecyrzp, sizeof(Vecyrzp)/sizeof(Vecyrzp[0]) },
+	{ &tmyrzn, Vecyrzn, sizeof(Vecyrzn)/sizeof(Vecyrzn[0]) },
+	#if YEAR_BASE == 1900
+	{ &tmyr0, Vecyr0, sizeof(Vecyr0)/sizeof(Vecyr0[0]) },
+	{ &tmyr1, Vecyr1, sizeof(Vecyr1)/sizeof(Vecyr1[0]) },
+	#endif
+	};
+
+
+/* List of tests to be run */
+const struct list  List[] = {
+	{ &tm0, Vec0, sizeof(Vec0)/sizeof(Vec0[0]) },
+	{ &tm1, Vec1, sizeof(Vec1)/sizeof(Vec1[0]) },
+	};
+
+#if defined(STUB_getenv_r)
+char *
+_getenv_r(struct _reent *p, const char *cp) { return getenv(cp); }
+#endif
+
+int
+main(void)
+{
+int  i, l, errr=0, erro=0, tot=0;
+const char  *cp;
+CHAR  out[OUTSIZE];
+size_t  ret;
+
+/* Set timezone so that %z and %Z tests come out right */
+cp = TZ;
+if((i=putenv(cp)))  {
+    printf( "putenv(%s) FAILED, ret %d\n", cp, i);
+    return(-1);
+    }
+if(strcmp(getenv("TZ"),strchr(TZ,'=')+1))  {
+    printf( "TZ not set properly in environment\n");
+    return(-2);
+    }
+tzset();
+
+#if defined(VERBOSE)
+printf("_timezone=%d, _daylight=%d, _tzname[0]=%s, _tzname[1]=%s\n", _timezone, _daylight, _tzname[0], _tzname[1]);
+{
+long offset;
+__tzinfo_type *tz = __gettzinfo ();
+/* The sign of this is exactly opposite the envvar TZ.  We
+   could directly use the global _timezone for tm_isdst==0,
+   but have to use __tzrule for daylight savings.  */
+printf("tz->__tzrule[0].offset=%d, tz->__tzrule[1].offset=%d\n", tz->__tzrule[0].offset, tz->__tzrule[1].offset);
+}
+#endif
+
+/* Run all of the exact-length tests as-given--results should match */
+for(l=0; l<sizeof(List)/sizeof(List[0]); l++)  {
+    const struct list  *test = &List[l];
+    for(i=0; i<test->cnt; i++)  {
+	tot++;	/* Keep track of number of tests */
+	ret = strftime(out, test->vec[i].max, test->vec[i].fmt, test->tms);
+	if(ret != test->vec[i].ret)  {
+	    errr++;
+	    fprintf(stderr,
+		"ERROR:  return %d != %d expected for List[%d].vec[%d]\n",
+						ret, test->vec[i].ret, l, i);
+	    }
+	if(strncmp(out, test->vec[i].out, test->vec[i].max-1))  {
+	    erro++;
+	    fprintf(stderr,
+		"ERROR:  \"%"SFLG"s\" != \"%"SFLG"s\" expected for List[%d].vec[%d]\n",
+						out, test->vec[i].out, l, i);
+	    }
+	}
+    }
+
+/* Run all of the exact-length tests with the length made too short--expect to
+ * fail.  */
+for(l=0; l<sizeof(List)/sizeof(List[0]); l++)  {
+    const struct list  *test = &List[l];
+    for(i=0; i<test->cnt; i++)  {
+	tot++;	/* Keep track of number of tests */
+	ret = strftime(out, test->vec[i].max-1, test->vec[i].fmt, test->tms);
+	if(ret != 0)  {
+	    errr++;
+	    fprintf(stderr,
+		"ERROR:  return %d != %d expected for List[%d].vec[%d]\n",
+						ret, 0, l, i);
+	    }
+	/* Almost every conversion puts out as many characters as possible, so
+	 * go ahead and test the output even though have failed.  (The test
+	 * times chosen happen to not hit any of the cases that fail this, so it
+	 * works.)  */
+	if(strncmp(out, test->vec[i].out, test->vec[i].max-1-1))  {
+	    erro++;
+	    fprintf(stderr,
+		"ERROR:  \"%"SFLG"s\" != \"%"SFLG"s\" expected for List[%d].vec[%d]\n",
+						out, test->vec[i].out, l, i);
+	    }
+	}
+    }
+
+/* Run all of the special year test cases */
+for(l=0; l<sizeof(ListYr)/sizeof(ListYr[0]); l++)  {
+    const struct list  *test = &ListYr[l];
+    for(i=0; i<test->cnt; i++)  {
+	tot++;	/* Keep track of number of tests */
+	ret = strftime(out, test->vec[i].max, test->vec[i].fmt, test->tms);
+	if(ret != test->vec[i].ret)  {
+	    errr++;
+	    fprintf(stderr,
+		"ERROR:  return %d != %d expected for ListYr[%d].vec[%d]\n",
+						ret, test->vec[i].ret, l, i);
+	    }
+	if(strncmp(out, test->vec[i].out, test->vec[i].max-1))  {
+	    erro++;
+	    fprintf(stderr,
+		"ERROR:  \"%"SFLG"s\" != \"%"SFLG"s\" expected for ListYr[%d].vec[%d]\n",
+						out, test->vec[i].out, l, i);
+	    }
+	}
+    }
+
+#define STRIZE(f)	#f
+#define NAME(f)	STRIZE(f)
+printf(NAME(strftime) "() test ");
+if(errr || erro)  printf("FAILED %d/%d of", errr, erro);
+  else    printf("passed");
+printf(" %d test cases.\n", tot);
+
+return(errr || erro);
+}
+#endif /* defined(_REGRESSION_TEST) ] */

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
       [not found] <562A996C.9070904@SystematicSw.ab.ca>
@ 2015-10-26 19:54 ` Brian Inglis
  2015-10-26 20:22   ` Brian Inglis
  2015-10-27  9:27   ` Brian Inglis
  0 siblings, 2 replies; 16+ messages in thread
From: Brian Inglis @ 2015-10-26 19:54 UTC (permalink / raw)
  To: cygwin, cygwin-patches, corinna-cygwin

Third time lucky - pasting inline into email and resending to all previous lists.

Please note that conversion into too-small buffer size in regression test may not have expected result!

Tried to build with below and variants:
gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf -I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o strftime-s-test strftime.c
gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset, __get_current_time_locale, __tz_lock, __tz_unlock,
_tzset_unlocked

Build stc with std cmdline and current strftime works and does demo issue.

-------- Forwarded Message --------
Subject: Fwd: Re: Bash unable to print epoch timestamp
Date: Fri, 23 Oct 2015 14:32:44 -0600
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Reply-To: Brian.Inglis@SystematicSw.ab.ca
Organisation: Systematic Software
To: corinna-cygwin@cygwin.com

Already forwarded as below to cygwin and ...patches-allow...
- should be HTML free and pass filters?
-- 
Take care. Thanks, Brian Inglis


-------- Forwarded Message --------
Subject: Re: Bash unable to print epoch timestamp
Date: Thu, 22 Oct 2015 18:08:52 -0600
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Reply-To: Brian.Inglis@SystematicSw.ab.ca
Organisation: Systematic Software
To: cygwin@cygwin.com, cygwin-patches-allow-subscribe@cygwin.com

Corinna Vinschen <corinna-cygwin <at> cygwin.com> wrote:
> On Oct 22 07:03, Brian Inglis wrote:
>> Brian Inglis <Brian.Inglis <at> SystematicSw.ab.ca> writes:
>> > Don Harrop <don <at> effx.us> writes:
>> > > Bash outputs no value when using it's built in method of printing an
>> > > "epoch" timestamp.
>> > > BashCommandLine#: printf '%(%s)T' -1
>> > bash printf depends on underlying strftime in newlib, which does not support
>> > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
>> > is presumably not defined in the config, as %s is not shown in man strftime.
>> > Workaround for now is use
>> > date +%s
>> > for current time, and
>> > date -d $(printf '%(%T)T' -2) +%s
>> > for shell invocation time.
>> > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
>> Wrong! Misread the code, strftime %s is not supported!

>> STC and suggested patch appended (posting from gmane), compiles, but can't
>> build STC as ld fails with undef refs, and I don't know all the correct
>> LD..., -L and -l incantations. Email me for original files.
> Cool, thanks for the patch. Unfortunately it doesn't apply cleanly.
> There are several unexpected line wraps and there's this:
>> --- a/newlib/time/strftime.c 2015-08-20 03:39:24.000000000 -0600
>> +++ b/newlib/time/strftime.c 2015-10-21 20:15:22.367453000 -0600
> How did this happen? If you checkout the newlib-cygwin git repo,
> strftime.c is under newlib/libc/time, not under newlib/time :o

Tried to download and build from source tarball, then cygport, then
local source file, but some unobvious build prereqs missing in all
cases, as reported by ld. Finally just diffed local source against
distro and posted from gmane, with attempted fixups in the post.

> Would you mind to attach a patch generated with git format-patch?

Sorry, not using git yet, as I am set up with hg on BitBucket
- AIUI the output is close enough the attached should work okay.

[cc ...patches-allow...]


-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada


----- >8 ----- 8< -----
/* newlib/libc/time/strftime.c %s format STC */
#include <stdio.h>
#include <time.h>

int main( int argc, char **argv) {
     char ss[BUFSIZ]	= "";
     time_t tt		= time( NULL );
     struct tm *tp	= gmtime( &tt );
     tt			= mktime( tp );
     size_t st		= strftime( ss, sizeof ss, "%s", tp);
     int rc		= puts( ss );
     st			= strftime( ss, sizeof ss, "%T", tp);
     rc			= puts( ss );
     return rc;
}
----- >8 ----- 8< -----
2015-10-12  Brian Inglis  <Brian.Inglis@SystematicSw.ab.ca>

	* newlib/libc/time/strftime.c (__strftime): add support for %s
	(seconds from Unix epoch)

--- a/newlib/libc/time/strftime.c	1969-12-31 17:00:00.000000000 -0700
+++ b/newlib/libc/time/strftime.c	2015-10-26 04:27:12.244016200 -0600
@@ -0,0 +1,1903 @@
+/* NOTE:  This file defines both strftime() and wcsftime().  Take care when
+ * making changes.  See also wcsftime.c, and note the (small) overlap in the
+ * manual description, taking care to edit both as needed.  */
+/*
+ * strftime.c
+ * Original Author:	G. Haley
+ * Additions from:	Eric Blake
+ * Changes to allow dual use as wcstime, also:	Craig Howland
+ *
+ * Places characters into the array pointed to by s as controlled by the string
+ * pointed to by format. If the total number of resulting characters including
+ * the terminating null character is not more than maxsize, returns the number
+ * of characters placed into the array pointed to by s (not including the
+ * terminating null character); otherwise zero is returned and the contents of
+ * the array indeterminate.
+ */
+
+/*
+FUNCTION
+<<strftime>>---convert date and time to a formatted string
+
+INDEX
+	strftime
+
+ANSI_SYNOPSIS
+	#include <time.h>
+	size_t strftime(char *restrict <[s]>, size_t <[maxsize]>,
+			const char *restrict <[format]>,
+                        const struct tm *restrict <[timp]>);
+
+TRAD_SYNOPSIS
+	#include <time.h>
+	size_t strftime(<[s]>, <[maxsize]>, <[format]>, <[timp]>)
+	char *<[s]>;
+	size_t <[maxsize]>;
+	char *<[format]>;
+	struct tm *<[timp]>;
+
+DESCRIPTION
+<<strftime>> converts a <<struct tm>> representation of the time (at
+<[timp]>) into a null-terminated string, starting at <[s]> and occupying
+no more than <[maxsize]> characters.
+
+You control the format of the output using the string at <[format]>.
+<<*<[format]>>> can contain two kinds of specifications: text to be
+copied literally into the formatted string, and time conversion
+specifications.  Time conversion specifications are two- and
+three-character sequences beginning with `<<%>>' (use `<<%%>>' to
+include a percent sign in the output).  Each defined conversion
+specification selects only the specified field(s) of calendar time
+data from <<*<[timp]>>>, and converts it to a string in one of the
+following ways:
+
+o+
+o %a
+The abbreviated weekday name according to the current locale. [tm_wday]
+
+o %A
+The full weekday name according to the current locale.
+In the default "C" locale, one of `<<Sunday>>', `<<Monday>>', `<<Tuesday>>',
+`<<Wednesday>>', `<<Thursday>>', `<<Friday>>', `<<Saturday>>'. [tm_wday]
+
+o %b
+The abbreviated month name according to the current locale. [tm_mon]
+
+o %B
+The full month name according to the current locale.
+In the default "C" locale, one of `<<January>>', `<<February>>',
+`<<March>>', `<<April>>', `<<May>>', `<<June>>', `<<July>>',
+`<<August>>', `<<September>>', `<<October>>', `<<November>>',
+`<<December>>'. [tm_mon]
+
+o %c
+The preferred date and time representation for the current locale.
+[tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_wday]
+
+o %C
+The century, that is, the year divided by 100 then truncated.  For
+4-digit years, the result is zero-padded and exactly two characters;
+but for other years, there may a negative sign or more digits.  In
+this way, `<<%C%y>>' is equivalent to `<<%Y>>'. [tm_year]
+
+o %d
+The day of the month, formatted with two digits (from `<<01>>' to
+`<<31>>'). [tm_mday]
+
+o %D
+A string representing the date, in the form `<<"%m/%d/%y">>'.
+[tm_mday, tm_mon, tm_year]
+
+o %e
+The day of the month, formatted with leading space if single digit
+(from `<<1>>' to `<<31>>'). [tm_mday]
+
+o %E<<x>>
+In some locales, the E modifier selects alternative representations of
+certain modifiers <<x>>.  In newlib, it is ignored, and treated as %<<x>>.
+
+o %F
+A string representing the ISO 8601:2000 date format, in the form
+`<<"%Y-%m-%d">>'. [tm_mday, tm_mon, tm_year]
+
+o %g
+The last two digits of the week-based year, see specifier %G (from
+`<<00>>' to `<<99>>'). [tm_year, tm_wday, tm_yday]
+
+o %G
+The week-based year. In the ISO 8601:2000 calendar, week 1 of the year
+includes January 4th, and begin on Mondays. Therefore, if January 1st,
+2nd, or 3rd falls on a Sunday, that day and earlier belong to the last
+week of the previous year; and if December 29th, 30th, or 31st falls
+on Monday, that day and later belong to week 1 of the next year.  For
+consistency with %Y, it always has at least four characters.
+Example: "%G" for Saturday 2nd January 1999 gives "1998", and for
+Tuesday 30th December 1997 gives "1998". [tm_year, tm_wday, tm_yday]
+
+o %h
+Synonym for "%b". [tm_mon]
+
+o %H
+The hour (on a 24-hour clock), formatted with two digits (from
+`<<00>>' to `<<23>>'). [tm_hour]
+
+o %I
+The hour (on a 12-hour clock), formatted with two digits (from
+`<<01>>' to `<<12>>'). [tm_hour]
+
+o %j
+The count of days in the year, formatted with three digits
+(from `<<001>>' to `<<366>>'). [tm_yday]
+
+o %k
+The hour (on a 24-hour clock), formatted with leading space if single
+digit (from `<<0>>' to `<<23>>'). Non-POSIX extension (c.p. %I). [tm_hour]
+
+o %l
+The hour (on a 12-hour clock), formatted with leading space if single
+digit (from `<<1>>' to `<<12>>'). Non-POSIX extension (c.p. %H). [tm_hour]
+
+o %m
+The month number, formatted with two digits (from `<<01>>' to `<<12>>').
+[tm_mon]
+
+o %M
+The minute, formatted with two digits (from `<<00>>' to `<<59>>'). [tm_min]
+
+o %n
+A newline character (`<<\n>>').
+
+o %O<<x>>
+In some locales, the O modifier selects alternative digit characters
+for certain modifiers <<x>>.  In newlib, it is ignored, and treated as %<<x>>.
+
+o %p
+Either `<<AM>>' or `<<PM>>' as appropriate, or the corresponding strings for
+the current locale. [tm_hour]
+
+o %P
+Same as '<<%p>>', but in lowercase.  This is a GNU extension. [tm_hour]
+
+o %r
+Replaced by the time in a.m. and p.m. notation.  In the "C" locale this
+is equivalent to "%I:%M:%S %p".  In locales which don't define a.m./p.m.
+notations, the result is an empty string. [tm_sec, tm_min, tm_hour]
+
+o %R
+The 24-hour time, to the minute.  Equivalent to "%H:%M". [tm_min, tm_hour]
+
+o %s
+The time elapsed, in seconds, since the start of the Unix epoch at
+1970-01-01 00:00:00 UTC.
+
+o %S
+The second, formatted with two digits (from `<<00>>' to `<<60>>').  The
+value 60 accounts for the occasional leap second. [tm_sec]
+
+o %t
+A tab character (`<<\t>>').
+
+o %T
+The 24-hour time, to the second.  Equivalent to "%H:%M:%S". [tm_sec,
+tm_min, tm_hour]
+
+o %u
+The weekday as a number, 1-based from Monday (from `<<1>>' to
+`<<7>>'). [tm_wday]
+
+o %U
+The week number, where weeks start on Sunday, week 1 contains the first
+Sunday in a year, and earlier days are in week 0.  Formatted with two
+digits (from `<<00>>' to `<<53>>').  See also <<%W>>. [tm_wday, tm_yday]
+
+o %V
+The week number, where weeks start on Monday, week 1 contains January 4th,
+and earlier days are in the previous year.  Formatted with two digits
+(from `<<01>>' to `<<53>>').  See also <<%G>>. [tm_year, tm_wday, tm_yday]
+
+o %w
+The weekday as a number, 0-based from Sunday (from `<<0>>' to `<<6>>').
+[tm_wday]
+
+o %W
+The week number, where weeks start on Monday, week 1 contains the first
+Monday in a year, and earlier days are in week 0.  Formatted with two
+digits (from `<<00>>' to `<<53>>'). [tm_wday, tm_yday]
+
+o %x
+Replaced by the preferred date representation in the current locale.
+In the "C" locale this is equivalent to "%m/%d/%y".
+[tm_mon, tm_mday, tm_year]
+
+o %X
+Replaced by the preferred time representation in the current locale.
+In the "C" locale this is equivalent to "%H:%M:%S". [tm_sec, tm_min, tm_hour]
+
+o %y
+The last two digits of the year (from `<<00>>' to `<<99>>'). [tm_year]
+(Implementation interpretation:  always positive, even for negative years.)
+
+o %Y
+The full year, equivalent to <<%C%y>>.  It will always have at least four
+characters, but may have more.  The year is accurate even when tm_year
+added to the offset of 1900 overflows an int. [tm_year]
+
+o %z
+The offset from UTC.  The format consists of a sign (negative is west of
+Greewich), two characters for hour, then two characters for minutes
+(-hhmm or +hhmm).  If tm_isdst is negative, the offset is unknown and no
+output is generated; if it is zero, the offset is the standard offset for
+the current time zone; and if it is positive, the offset is the daylight
+savings offset for the current timezone. The offset is determined from
+the TZ environment variable, as if by calling tzset(). [tm_isdst]
+
+o %Z
+The time zone name.  If tm_isdst is negative, no output is generated.
+Otherwise, the time zone name is based on the TZ environment variable,
+as if by calling tzset(). [tm_isdst]
+
+o %%
+A single character, `<<%>>'.
+o-
+
+RETURNS
+When the formatted time takes up no more than <[maxsize]> characters,
+the result is the length of the formatted string.  Otherwise, if the
+formatting operation was abandoned due to lack of room, the result is
+<<0>>, and the string starting at <[s]> corresponds to just those
+parts of <<*<[format]>>> that could be completely filled in within the
+<[maxsize]> limit.
+
+PORTABILITY
+ANSI C requires <<strftime>>, but does not specify the contents of
+<<*<[s]>>> when the formatted string would require more than
+<[maxsize]> characters.  Unrecognized specifiers and fields of
+<<timp>> that are out of range cause undefined results.  Since some
+formats expand to 0 bytes, it is wise to set <<*<[s]>>> to a nonzero
+value beforehand to distinguish between failure and an empty string.
+This implementation does not support <<s>> being NULL, nor overlapping
+<<s>> and <<format>>.
+
+<<strftime>> requires no supporting OS subroutines.
+
+BUGS
+<<strftime>> ignores the LC_TIME category of the current locale, hard-coding
+the "C" locale settings.
+*/
+
+#include <newlib.h>
+#include <sys/config.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <ctype.h>
+#include <wctype.h>
+#include "local.h"
+#include "../locale/timelocal.h"
+
+/* Defines to make the file dual use for either strftime() or wcsftime().
+ * To get wcsftime, define MAKE_WCSFTIME.
+ * To get strftime, do not define MAKE_WCSFTIME.
+ * Names are kept friendly to strftime() usage.  The biggest ugliness is the
+ * use of the CQ() macro to make either regular character constants and
+ * string literals or wide-character constants and wide-character-string
+ * literals, as appropriate.  */
+#if !defined(MAKE_WCSFTIME)
+#  define CHAR		char		/* string type basis */
+#  define CQ(a)		a		/* character constant qualifier */
+#  define SFLG				/* %s flag (null for normal char) */
+#  define _ctloc(x) (ctloclen = strlen (ctloc = _CurrentTimeLocale->x), ctloc)
+#  define snprintf	sniprintf	/* avoid to pull in FP functions. */
+#  define TOLOWER(c)	tolower((int)(unsigned char)(c))
+#  define STRTOUL(c,p,b) strtoul((c),(p),(b))
+#  define STRCPY(a,b)	strcpy((a),(b))
+#  define STRCHR(a,b)	strchr((a),(b))
+#  define STRLEN(a)	strlen(a)
+# else
+#  define strftime	wcsftime	/* Alternate function name */
+#  define CHAR		wchar_t		/* string type basis */
+#  define CQ(a)		L##a		/* character constant qualifier */
+#  define snprintf	swprintf	/* wide-char equivalent function name */
+#  define strncmp	wcsncmp		/* wide-char equivalent function name */
+#  define TOLOWER(c)	towlower((wint_t)(c))
+#  define STRTOUL(c,p,b) wcstoul((c),(p),(b))
+#  define STRCPY(a,b)	wcscpy((a),(b))
+#  define STRCHR(a,b)	wcschr((a),(b))
+#  define STRLEN(a)	wcslen(a)
+#  define SFLG		"l"		/* %s flag (l for wide char) */
+#  ifdef __HAVE_LOCALE_INFO_EXTENDED__
+#   define _ctloc(x) (ctloclen = wcslen (ctloc = _CurrentTimeLocale->w##x), \
+		      ctloc)
+#  else
+#   define CTLOCBUFLEN   256		/* Arbitrary big buffer size */
+    const wchar_t *
+    __ctloc (wchar_t *buf, const char *elem, size_t *len_ret)
+    {
+      buf[CTLOCBUFLEN - 1] = L'\0';
+      *len_ret = mbstowcs (buf, elem, CTLOCBUFLEN - 1);
+      if (*len_ret == (size_t) -1 )
+	*len_ret = 0;
+      return buf;
+    }
+#   define _ctloc(x) (ctloc = __ctloc (ctlocbuf, _CurrentTimeLocale->x, \
+		      &ctloclen))
+#  endif
+#endif  /* MAKE_WCSFTIME */
+
+#define CHECK_LENGTH()	if (len < 0 || (count += len) >= maxsize) \
+			  return 0
+
+/* Enforce the coding assumptions that YEAR_BASE is positive.  (%C, %Y, etc.) */
+#if YEAR_BASE < 0
+#  error "YEAR_BASE < 0"
+#endif
+
+static _CONST int dname_len[7] =
+{6, 6, 7, 9, 8, 6, 8};
+
+/* Using the tm_year, tm_wday, and tm_yday components of TIM_P, return
+   -1, 0, or 1 as the adjustment to add to the year for the ISO week
+   numbering used in "%g%G%V", avoiding overflow.  */
+static int
+_DEFUN (iso_year_adjust, (tim_p),
+	_CONST struct tm *tim_p)
+{
+  /* Account for fact that tm_year==0 is year 1900.  */
+  int leap = isleap (tim_p->tm_year + (YEAR_BASE
+				       - (tim_p->tm_year < 0 ? 0 : 2000)));
+
+  /* Pack the yday, wday, and leap year into a single int since there are so
+     many disparate cases.  */
+#define PACK(yd, wd, lp) (((yd) << 4) + (wd << 1) + (lp))
+  switch (PACK (tim_p->tm_yday, tim_p->tm_wday, leap))
+    {
+    case PACK (0, 5, 0): /* Jan 1 is Fri, not leap.  */
+    case PACK (0, 6, 0): /* Jan 1 is Sat, not leap.  */
+    case PACK (0, 0, 0): /* Jan 1 is Sun, not leap.  */
+    case PACK (0, 5, 1): /* Jan 1 is Fri, leap year.  */
+    case PACK (0, 6, 1): /* Jan 1 is Sat, leap year.  */
+    case PACK (0, 0, 1): /* Jan 1 is Sun, leap year.  */
+    case PACK (1, 6, 0): /* Jan 2 is Sat, not leap.  */
+    case PACK (1, 0, 0): /* Jan 2 is Sun, not leap.  */
+    case PACK (1, 6, 1): /* Jan 2 is Sat, leap year.  */
+    case PACK (1, 0, 1): /* Jan 2 is Sun, leap year.  */
+    case PACK (2, 0, 0): /* Jan 3 is Sun, not leap.  */
+    case PACK (2, 0, 1): /* Jan 3 is Sun, leap year.  */
+      return -1; /* Belongs to last week of previous year.  */
+    case PACK (362, 1, 0): /* Dec 29 is Mon, not leap.  */
+    case PACK (363, 1, 1): /* Dec 29 is Mon, leap year.  */
+    case PACK (363, 1, 0): /* Dec 30 is Mon, not leap.  */
+    case PACK (363, 2, 0): /* Dec 30 is Tue, not leap.  */
+    case PACK (364, 1, 1): /* Dec 30 is Mon, leap year.  */
+    case PACK (364, 2, 1): /* Dec 30 is Tue, leap year.  */
+    case PACK (364, 1, 0): /* Dec 31 is Mon, not leap.  */
+    case PACK (364, 2, 0): /* Dec 31 is Tue, not leap.  */
+    case PACK (364, 3, 0): /* Dec 31 is Wed, not leap.  */
+    case PACK (365, 1, 1): /* Dec 31 is Mon, leap year.  */
+    case PACK (365, 2, 1): /* Dec 31 is Tue, leap year.  */
+    case PACK (365, 3, 1): /* Dec 31 is Wed, leap year.  */
+      return 1; /* Belongs to first week of next year.  */
+    }
+  return 0; /* Belongs to specified year.  */
+#undef PACK
+}
+
+#ifdef _WANT_C99_TIME_FORMATS
+typedef struct {
+  int   year;
+  CHAR *era_C;
+  CHAR *era_Y;
+} era_info_t;
+
+static era_info_t *
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+get_era_info (const struct tm *tim_p, const wchar_t *era)
+#else
+get_era_info (const struct tm *tim_p, const char *era)
+#endif
+{
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  wchar_t *c;
+  const wchar_t *dir;
+# define ERA_STRCHR(a,b)	wcschr((a),(b))
+# define ERA_STRNCPY(a,b,c)	wcsncpy((a),(b),(c))
+# define ERA_STRTOL(a,b,c)	wcstol((a),(b),(c))
+#else
+  char *c;
+  const char *dir;
+# define ERA_STRCHR(a,b)	strchr((a),(b))
+# define ERA_STRNCPY(a,b,c)	strncpy((a),(b),(c))
+# define ERA_STRTOL(a,b,c)	strtol((a),(b),(c))
+#endif
+  long offset;
+  struct tm stm, etm;
+  era_info_t *ei;
+
+  ei = (era_info_t *) calloc (1, sizeof (era_info_t));
+  if (!ei)
+    return NULL;
+
+  stm.tm_isdst = etm.tm_isdst = 0;
+  while (era)
+    {
+      dir = era;
+      era += 2;
+      offset = ERA_STRTOL (era, &c, 10);
+      era = c + 1;
+      stm.tm_year = ERA_STRTOL (era, &c, 10) - YEAR_BASE;
+      /* Adjust offset for negative gregorian dates. */
+      if (stm.tm_year <= -YEAR_BASE)
+      	++stm.tm_year;
+      stm.tm_mon = ERA_STRTOL (c + 1, &c, 10) - 1;
+      stm.tm_mday = ERA_STRTOL (c + 1, &c, 10);
+      stm.tm_hour = stm.tm_min = stm.tm_sec = 0;
+      era = c + 1;
+      if (era[0] == '-' && era[1] == '*')
+      	{
+	  etm = stm;
+	  stm.tm_year = INT_MIN;
+	  stm.tm_mon = stm.tm_mday = stm.tm_hour = stm.tm_min = stm.tm_sec = 0;
+	  era += 3;
+	}
+      else if (era[0] == '+' && era[1] == '*')
+	{
+	  etm.tm_year = INT_MAX;
+	  etm.tm_mon = 11;
+	  etm.tm_mday = 31;
+	  etm.tm_hour = 23;
+	  etm.tm_min = etm.tm_sec = 59;
+	  era += 3;
+	}
+      else
+      	{
+	  etm.tm_year = ERA_STRTOL (era, &c, 10) - YEAR_BASE;
+	  /* Adjust offset for negative gregorian dates. */
+	  if (etm.tm_year <= -YEAR_BASE)
+	    ++etm.tm_year;
+	  etm.tm_mon = ERA_STRTOL (c + 1, &c, 10) - 1;
+	  etm.tm_mday = ERA_STRTOL (c + 1, &c, 10);
+	  etm.tm_mday = 31;
+	  etm.tm_hour = 23;
+	  etm.tm_min = etm.tm_sec = 59;
+	  era = c + 1;
+	}
+      if ((tim_p->tm_year > stm.tm_year
+	   || (tim_p->tm_year == stm.tm_year
+	       && (tim_p->tm_mon > stm.tm_mon
+		   || (tim_p->tm_mon == stm.tm_mon
+		       && tim_p->tm_mday >= stm.tm_mday))))
+	  && (tim_p->tm_year < etm.tm_year
+	      || (tim_p->tm_year == etm.tm_year
+		  && (tim_p->tm_mon < etm.tm_mon
+		      || (tim_p->tm_mon == etm.tm_mon
+			  && tim_p->tm_mday <= etm.tm_mday)))))
+	{
+	  /* Gotcha */
+	  size_t len;
+
+	  /* year */
+	  if (*dir == '+' && stm.tm_year != INT_MIN)
+	    ei->year = tim_p->tm_year - stm.tm_year + offset;
+	  else
+	    ei->year = etm.tm_year - tim_p->tm_year + offset;
+	  /* era_C */
+	  c = ERA_STRCHR (era, ':');
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (NULL, &era, c - era, 0, NULL);
+	  if (len == (size_t) -1)
+	    {
+	      free (ei);
+	      return NULL;
+	    }
+#else
+	  len = c - era;
+#endif
+	  ei->era_C = (CHAR *) malloc ((len + 1) * sizeof (CHAR));
+	  if (!ei->era_C)
+	    {
+	      free (ei);
+	      return NULL;
+	    }
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (ei->era_C, &era, c - era, len + 1, NULL);
+#else
+	  ERA_STRNCPY (ei->era_C, era, len);
+	  era += len;
+#endif
+	  ei->era_C[len] = CQ('\0');
+	  /* era_Y */
+	  ++era;
+	  c = ERA_STRCHR (era, ';');
+	  if (!c)
+	    c = ERA_STRCHR (era, '\0');
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (NULL, &era, c - era, 0, NULL);
+	  if (len == (size_t) -1)
+	    {
+	      free (ei->era_C);
+	      free (ei);
+	      return NULL;
+	    }
+#else
+	  len = c - era;
+#endif
+	  ei->era_Y = (CHAR *) malloc ((len + 1) * sizeof (CHAR));
+	  if (!ei->era_Y)
+	    {
+	      free (ei->era_C);
+	      free (ei);
+	      return NULL;
+	    }
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  len = mbsnrtowcs (ei->era_Y, &era, c - era, len + 1, NULL);
+#else
+	  ERA_STRNCPY (ei->era_Y, era, len);
+	  era += len;
+#endif
+	  ei->era_Y[len] = CQ('\0');
+	  return ei;
+	}
+      else
+	era = ERA_STRCHR (era, ';');
+      if (era)
+	++era;
+    }
+  return NULL;
+}
+
+static void
+free_era_info (era_info_t *ei)
+{
+  free (ei->era_C);
+  free (ei->era_Y);
+  free (ei);
+}
+
+typedef struct {
+  size_t num;
+  CHAR **digit;
+  CHAR *buffer;
+} alt_digits_t;
+
+static alt_digits_t *
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+get_alt_digits (const wchar_t *alt_digits)
+#else
+get_alt_digits (const char *alt_digits)
+#endif
+{
+  alt_digits_t *adi;
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  const wchar_t *a, *e;
+# define ALT_STRCHR(a,b)	wcschr((a),(b))
+# define ALT_STRCPY(a,b)	wcscpy((a),(b))
+# define ALT_STRLEN(a)		wcslen(a)
+#else
+  const char *a, *e;
+# define ALT_STRCHR(a,b)	strchr((a),(b))
+# define ALT_STRCPY(a,b)	strcpy((a),(b))
+# define ALT_STRLEN(a)		strlen(a)
+#endif
+  CHAR *aa, *ae;
+  size_t len;
+
+  adi = (alt_digits_t *) calloc (1, sizeof (alt_digits_t));
+  if (!adi)
+    return NULL;
+
+  /* Compute number of alt_digits. */
+  adi->num = 1;
+  for (a = alt_digits; (e = ALT_STRCHR (a, ';')) != NULL; a = e + 1)
+      ++adi->num;
+  /* Allocate the `digit' array, which is an array of `num' pointers into
+     `buffer'. */
+  adi->digit = (CHAR **) calloc (adi->num, sizeof (CHAR **));
+  if (!adi->digit)
+    {
+      free (adi);
+      return NULL;
+    }
+  /* Compute memory required for `buffer'. */
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  len = mbstowcs (NULL, alt_digits, 0);
+  if (len == (size_t) -1)
+    {
+      free (adi->digit);
+      free (adi);
+      return NULL;
+    }
+#else
+  len = ALT_STRLEN (alt_digits);
+#endif
+  /* Allocate it. */
+  adi->buffer = (CHAR *) malloc ((len + 1) * sizeof (CHAR));
+  if (!adi->buffer)
+    {
+      free (adi->digit);
+      free (adi);
+      return NULL;
+    }
+  /* Store digits in it. */
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  mbstowcs (adi->buffer, alt_digits, len + 1);
+#else
+  ALT_STRCPY (adi->buffer, alt_digits);
+#endif
+  /* Store the pointers into `buffer' into the appropriate `digit' slot. */
+  for (len = 0, aa = adi->buffer; (ae = STRCHR (aa, CQ(';'))) != NULL;
+       ++len, aa = ae + 1)
+    {
+      *ae = '\0';
+      adi->digit[len] = aa;
+    }
+  adi->digit[len] = aa;
+  return adi;
+}
+
+static void
+free_alt_digits (alt_digits_t *adi)
+{
+  free (adi->digit);
+  free (adi->buffer);
+  free (adi);
+}
+
+/* Return 0 if no alt_digit is available for a number.
+   Return -1 if buffer size isn't sufficient to hold alternative digit.
+   Return length of new digit otherwise. */
+static int
+conv_to_alt_digits (CHAR *buf, size_t bufsiz, unsigned num, alt_digits_t *adi)
+{
+  if (num < adi->num)
+    {
+      size_t len = STRLEN (adi->digit[num]);
+      if (bufsiz < len)
+      	return -1;
+      STRCPY (buf, adi->digit[num]);
+      return (int) len;
+    }
+  return 0;
+}
+
+static size_t __strftime (CHAR *, size_t, const CHAR *, const struct tm *,
+			  era_info_t **, alt_digits_t **);
+
+size_t
+_DEFUN (strftime, (s, maxsize, format, tim_p),
+	CHAR *__restrict s _AND
+	size_t maxsize _AND
+	_CONST CHAR *__restrict format _AND
+	_CONST struct tm *__restrict tim_p)
+{
+  era_info_t *era_info = NULL;
+  alt_digits_t *alt_digits = NULL;
+  size_t ret = __strftime (s, maxsize, format, tim_p, &era_info, &alt_digits);
+  if (era_info)
+    free_era_info (era_info);
+  if (alt_digits)
+    free_alt_digits (alt_digits);
+  return ret;
+}
+
+static size_t
+__strftime (CHAR *s, size_t maxsize, const CHAR *format,
+	    const struct tm *tim_p, era_info_t **era_info,
+	    alt_digits_t **alt_digits)
+#else /* !_WANT_C99_TIME_FORMATS */
+# define __strftime(s,m,f,t,e,a)	strftime((s),(m),(f),(t))
+
+size_t
+_DEFUN (strftime, (s, maxsize, format, tim_p),
+	CHAR *__restrict s _AND
+	size_t maxsize _AND
+	_CONST CHAR *__restrict format _AND
+	_CONST struct tm *__restrict tim_p)
+#endif /* !_WANT_C99_TIME_FORMATS */
+{
+  size_t count = 0;
+  int len = 0;
+  const CHAR *ctloc;
+#if defined (MAKE_WCSFTIME) && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
+  CHAR ctlocbuf[CTLOCBUFLEN];
+#endif
+  size_t i, ctloclen;
+  CHAR alt;
+  CHAR pad;
+  unsigned long width;
+  int tzset_called = 0;
+
+  struct lc_time_T *_CurrentTimeLocale = __get_current_time_locale ();
+  for (;;)
+    {
+      while (*format && *format != CQ('%'))
+	{
+	  if (count < maxsize - 1)
+	    s[count++] = *format++;
+	  else
+	    return 0;
+	}
+      if (*format == CQ('\0'))
+	break;
+      format++;
+      pad = '\0';
+      width = 0;
+
+      /* POSIX-1.2008 feature: '0' and '+' modifiers require 0-padding with
+         slightly different semantics. */
+      if (*format == CQ('0') || *format == CQ('+'))
+	pad = *format++;
+
+      /* POSIX-1.2008 feature: A minimum field width can be specified. */
+      if (*format >= CQ('1') && *format <= CQ('9'))
+      	{
+	  CHAR *fp;
+	  width = STRTOUL (format, &fp, 10);
+	  format = fp;
+	}
+
+      alt = CQ('\0');
+      if (*format == CQ('E'))
+	{
+	  alt = *format++;
+#ifdef _WANT_C99_TIME_FORMATS
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  if (!*era_info && *_CurrentTimeLocale->wera)
+	    *era_info = get_era_info (tim_p, _CurrentTimeLocale->wera);
+#else
+	  if (!*era_info && *_CurrentTimeLocale->era)
+	    *era_info = get_era_info (tim_p, _CurrentTimeLocale->era);
+#endif
+#endif /* _WANT_C99_TIME_FORMATS */
+	}
+      else if (*format == CQ('O'))
+	{
+	  alt = *format++;
+#ifdef _WANT_C99_TIME_FORMATS
+#if defined (MAKE_WCSFTIME) && defined (__HAVE_LOCALE_INFO_EXTENDED__)
+	  if (!*alt_digits && *_CurrentTimeLocale->walt_digits)
+	    *alt_digits = get_alt_digits (_CurrentTimeLocale->walt_digits);
+#else
+	  if (!*alt_digits && *_CurrentTimeLocale->alt_digits)
+	    *alt_digits = get_alt_digits (_CurrentTimeLocale->alt_digits);
+#endif
+#endif /* _WANT_C99_TIME_FORMATS */
+	}
+
+      switch (*format)
+	{
+	case CQ('a'):
+	  _ctloc (wday[tim_p->tm_wday]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('A'):
+	  _ctloc (weekday[tim_p->tm_wday]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('b'):
+	case CQ('h'):
+	  _ctloc (mon[tim_p->tm_mon]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('B'):
+	  _ctloc (month[tim_p->tm_mon]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = ctloc[i];
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('c'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info && *_CurrentTimeLocale->era_d_t_fmt)
+	    _ctloc (era_d_t_fmt);
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    _ctloc (c_fmt);
+	  goto recurse;
+	case CQ('r'):
+	  _ctloc (ampm_fmt);
+	  goto recurse;
+	case CQ('x'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info && *_CurrentTimeLocale->era_d_fmt)
+	    _ctloc (era_d_fmt);
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    _ctloc (x_fmt);
+	  goto recurse;
+	case CQ('X'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info && *_CurrentTimeLocale->era_t_fmt)
+	    _ctloc (era_t_fmt);
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    _ctloc (X_fmt);
+recurse:
+	  if (*ctloc)
+	    {
+	      /* Recurse to avoid need to replicate %Y formation. */
+	      len = __strftime (&s[count], maxsize - count, ctloc, tim_p,
+				era_info, alt_digits);
+	      if (len > 0)
+		count += len;
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('C'):
+	  {
+	    /* Examples of (tm_year + YEAR_BASE) that show how %Y == %C%y
+	       with 32-bit int.
+	       %Y		%C		%y
+	       2147485547	21474855	47
+	       10000		100		00
+	       9999		99		99
+	       0999		09		99
+	       0099		00		99
+	       0001		00		01
+	       0000		00		00
+	       -001		-0		01
+	       -099		-0		99
+	       -999		-9		99
+	       -1000		-10		00
+	       -10000		-100		00
+	       -2147481748	-21474817	48
+
+	       Be careful of both overflow and sign adjustment due to the
+	       asymmetric range of years.
+	    */
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt == 'E' && *era_info)
+	      len = snprintf (&s[count], maxsize - count, CQ("%" SFLG "s"),
+			      (*era_info)->era_C);
+	    else
+#endif /* _WANT_C99_TIME_FORMATS */
+	      {
+		CHAR *fmt = CQ("%s%.*d");
+		char *pos = "";
+		int neg = tim_p->tm_year < -YEAR_BASE;
+		int century = tim_p->tm_year >= 0
+		  ? tim_p->tm_year / 100 + YEAR_BASE / 100
+		  : abs (tim_p->tm_year + YEAR_BASE) / 100;
+		if (pad) /* '0' or '+' */
+		  {
+		    fmt = CQ("%s%0.*d");
+		    if (century >= 100 && pad == CQ('+'))
+		      pos = "+";
+		  }
+		if (width < 2)
+		  width = 2;
+		len = snprintf (&s[count], maxsize - count, fmt,
+				neg ? "-" : pos, width - neg, century);
+	      }
+            CHECK_LENGTH ();
+	  }
+	  break;
+	case CQ('d'):
+	case CQ('e'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      if (tim_p->tm_mday < 10)
+	      	{
+		  if (*format == CQ('d'))
+		    {
+		      if (maxsize - count < 2) return 0;
+		      len = conv_to_alt_digits (&s[count], maxsize - count,
+						0, *alt_digits);
+		      CHECK_LENGTH ();
+		    }
+		  if (*format == CQ('e') || len == 0)
+		    s[count++] = CQ(' ');
+		}
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_mday, *alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+	  len = snprintf (&s[count], maxsize - count,
+			  *format == CQ('d') ? CQ("%.2d") : CQ("%2d"),
+			  tim_p->tm_mday);
+	  CHECK_LENGTH ();
+	  break;
+	case CQ('D'):
+	  /* %m/%d/%y */
+	  len = snprintf (&s[count], maxsize - count,
+			  CQ("%.2d/%.2d/%.2d"),
+			  tim_p->tm_mon + 1, tim_p->tm_mday,
+			  tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+			  : abs (tim_p->tm_year + YEAR_BASE) % 100);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('F'):
+	  { /* %F is equivalent to "%+4Y-%m-%d", flags and width can change
+	       that.  Recurse to avoid need to replicate %Y formation. */
+	    CHAR fmtbuf[32], *fmt = fmtbuf;
+	
+	    *fmt++ = CQ('%');
+	    if (pad) /* '0' or '+' */
+	      *fmt++ = pad;
+	    else
+	      *fmt++ = '+';
+	    if (!pad)
+	      width = 10;
+	    if (width < 6)
+	      width = 6;
+	    width -= 6;
+	    if (width)
+	      {
+		len = snprintf (fmt, fmtbuf + 32 - fmt, CQ("%lu"), width);
+		if (len > 0)
+		  fmt += len;
+	      }
+	    STRCPY (fmt, CQ("Y-%m-%d"));
+	    len = __strftime (&s[count], maxsize - count, fmtbuf, tim_p,
+			      era_info, alt_digits);
+	    if (len > 0)
+	      count += len;
+	    else
+	      return 0;
+	  }
+          break;
+	case CQ('g'):
+	  /* Be careful of both overflow and negative years, thanks to
+		 the asymmetric range of years.  */
+	  {
+	    int adjust = iso_year_adjust (tim_p);
+	    int year = tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+		: abs (tim_p->tm_year + YEAR_BASE) % 100;
+	    if (adjust < 0 && tim_p->tm_year <= -YEAR_BASE)
+		adjust = 1;
+	    else if (adjust > 0 && tim_p->tm_year < -YEAR_BASE)
+		adjust = -1;
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    ((year + adjust) % 100 + 100) % 100);
+            CHECK_LENGTH ();
+	  }
+          break;
+	case CQ('G'):
+	  {
+	    /* See the comments for 'C' and 'Y'; this is a variable length
+	       field.  Although there is no requirement for a minimum number
+	       of digits, we use 4 for consistency with 'Y'.  */
+	    int sign = tim_p->tm_year < -YEAR_BASE;
+	    int adjust = iso_year_adjust (tim_p);
+	    int century = tim_p->tm_year >= 0
+	      ? tim_p->tm_year / 100 + YEAR_BASE / 100
+	      : abs (tim_p->tm_year + YEAR_BASE) / 100;
+	    int year = tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+	      : abs (tim_p->tm_year + YEAR_BASE) % 100;
+	    if (adjust < 0 && tim_p->tm_year <= -YEAR_BASE)
+	      sign = adjust = 1;
+	    else if (adjust > 0 && sign)
+	      adjust = -1;
+	    year += adjust;
+	    if (year == -1)
+	      {
+		year = 99;
+		--century;
+	      }
+	    else if (year == 100)
+	      {
+		year = 0;
+		++century;
+	      }
+	    CHAR fmtbuf[10], *fmt = fmtbuf;
+	    /* int potentially overflows, so use unsigned instead.  */
+	    unsigned p_year = century * 100 + year;
+	    if (sign)
+	      *fmt++ = CQ('-');
+	    else if (pad == CQ('+') && p_year >= 10000)
+	      {
+		*fmt++ = CQ('+');
+		sign = 1;
+	      }
+	    if (width && sign)
+	      --width;
+	    *fmt++ = CQ('%');
+	    if (pad)
+	      *fmt++ = CQ('0');
+	    STRCPY (fmt, CQ(".*u"));
+	    len = snprintf (&s[count], maxsize - count, fmtbuf, width, p_year);
+            if (len < 0  ||  (count+=len) >= maxsize)
+              return 0;
+	  }
+          break;
+	case CQ('H'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_hour, *alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+	  /*FALLTHRU*/
+	case CQ('k'):	/* newlib extension */
+	  len = snprintf (&s[count], maxsize - count,
+			  *format == CQ('k') ? CQ("%2d") : CQ("%.2d"),
+			  tim_p->tm_hour);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('l'):	/* newlib extension */
+	  if (alt == CQ('O'))
+	    alt = CQ('\0');
+	  /*FALLTHRU*/
+	case CQ('I'):
+	  {
+	    register int  h12;
+	    h12 = (tim_p->tm_hour == 0 || tim_p->tm_hour == 12)  ?
+						12  :  tim_p->tm_hour % 12;
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt != CQ('O') || !*alt_digits
+		|| !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					       h12, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	      len = snprintf (&s[count], maxsize - count,
+			      *format == CQ('I') ? CQ("%.2d") : CQ("%2d"), h12);
+	    CHECK_LENGTH ();
+	  }
+	  break;
+	case CQ('j'):
+	  len = snprintf (&s[count], maxsize - count, CQ("%.3d"),
+			  tim_p->tm_yday + 1);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('m'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     tim_p->tm_mon + 1, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    tim_p->tm_mon + 1);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('M'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     tim_p->tm_min, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    tim_p->tm_min);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('n'):
+	  if (count < maxsize - 1)
+	    s[count++] = CQ('\n');
+	  else
+	    return 0;
+	  break;
+	case CQ('p'):
+	case CQ('P'):
+	  _ctloc (am_pm[tim_p->tm_hour < 12 ? 0 : 1]);
+	  for (i = 0; i < ctloclen; i++)
+	    {
+	      if (count < maxsize - 1)
+		s[count++] = (*format == CQ('P') ? TOLOWER (ctloc[i])
+						 : ctloc[i]);
+	      else
+		return 0;
+	    }
+	  break;
+	case CQ('R'):
+          len = snprintf (&s[count], maxsize - count, CQ("%.2d:%.2d"),
+			  tim_p->tm_hour, tim_p->tm_min);
+          CHECK_LENGTH ();
+          break;
+	case CQ('s'):
+/*
+ * From:
+ * The Open Group Base Specifications Issue 7
+ * IEEE Std 1003.1, 2013 Edition
+ * Copyright (c) 2001-2013 The IEEE and The Open Group
+ * XBD Base Definitions
+ * 4. General Concepts
+ * 4.15 Seconds Since the Epoch
+ * A value that approximates the number of seconds that have elapsed since the
+ * Epoch. A Coordinated Universal Time name (specified in terms of seconds
+ * (tm_sec), minutes (tm_min), hours (tm_hour), days since January 1 of the year
+ * (tm_yday), and calendar year minus 1900 (tm_year)) is related to a time
+ * represented as seconds since the Epoch, according to the expression below.
+ * If the year is <1970 or the value is negative, the relationship is undefined.
+ * If the year is >=1970 and the value is non-negative, the value is related to a
+ * Coordinated Universal Time name according to the C-language expression, where
+ * tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all integer types:
+ * tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
+ *     (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
+ *     ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
+ * OR
+ * ((((tm_year-69)/4 - (tm_year-1)/100 + (tm_year+299)/400 +
+ *         (tm_year-70)*365 + tm_yday)*24 + tm_hour)*60 + tm_min)*60 + tm_sec
+ */
+/* modified from %z case by hoisting offset outside if block and initializing */
+	  {
+	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
+	    offset = 0;	   subtract to get UTC */
+
+	    if (tim_p->tm_isdst >= 0)
+	      {
+		TZ_LOCK;
+		if (!tzset_called)
+		  {
+		    _tzset_unlocked ();
+		    tzset_called = 1;
+		  }
+
+#if defined (__CYGWIN__)
+		/* Cygwin must check if the application has been built with or
+		   without the extra tm members for backward compatibility, and
+		   then use either that or the old method fetching from tzinfo.
+		   Rather than pulling in the version check infrastructure, we
+		   just call a Cygwin function. */
+		extern long __cygwin_gettzoffset (const struct tm *tmp);
+		offset = __cygwin_gettzoffset (tim_p);
+#elif defined (__TM_GMTOFF)
+		offset = tim_p->__TM_GMTOFF;
+#else
+		__tzinfo_type *tz = __gettzinfo ();
+		/* The sign of this is exactly opposite the envvar TZ.  We
+		   could directly use the global _timezone for tm_isdst==0,
+		   but have to use __tzrule for daylight savings.  */
+		offset = -tz->__tzrule[tim_p->tm_isdst > 0].offset;
+#endif
+		TZ_UNLOCK;
+	      }
+	    len = snprintf (&s[count], maxsize - count, CQ("%lld"),
+			    (((((long long)tim_p->tm_year - 69)/4
+				- (tim_p->tm_year - 1)/100
+				+ (tim_p->tm_year + 299)/400
+				+ (tim_p->tm_year - 70)*365 + tim_p->tm_yday)*24
+			      + tim_p->tm_hour)*60 + tim_p->tm_min)*60
+			    + tim_p->tm_sec - offset);
+	    CHECK_LENGTH ();
+	  }
+          break;
+	case CQ('S'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     tim_p->tm_sec, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			    tim_p->tm_sec);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('t'):
+	  if (count < maxsize - 1)
+	    s[count++] = CQ('\t');
+	  else
+	    return 0;
+	  break;
+	case CQ('T'):
+          len = snprintf (&s[count], maxsize - count, CQ("%.2d:%.2d:%.2d"),
+			  tim_p->tm_hour, tim_p->tm_min, tim_p->tm_sec);
+          CHECK_LENGTH ();
+          break;
+	case CQ('u'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_wday == 0 ? 7
+							    : tim_p->tm_wday,
+					*alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+          if (count < maxsize - 1)
+            {
+              if (tim_p->tm_wday == 0)
+                s[count++] = CQ('7');
+              else
+                s[count++] = CQ('0') + tim_p->tm_wday;
+            }
+          else
+            return 0;
+          break;
+	case CQ('U'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt != CQ('O') || !*alt_digits
+	      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					     (tim_p->tm_yday + 7 -
+					      tim_p->tm_wday) / 7,
+					     *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+			 (tim_p->tm_yday + 7 -
+			  tim_p->tm_wday) / 7);
+          CHECK_LENGTH ();
+	  break;
+	case CQ('V'):
+	  {
+	    int adjust = iso_year_adjust (tim_p);
+	    int wday = (tim_p->tm_wday) ? tim_p->tm_wday - 1 : 6;
+	    int week = (tim_p->tm_yday + 10 - wday) / 7;
+	    if (adjust > 0)
+		week = 1;
+	    else if (adjust < 0)
+		/* Previous year has 53 weeks if current year starts on
+		   Fri, and also if current year starts on Sat and
+		   previous year was leap year.  */
+		week = 52 + (4 >= (wday - tim_p->tm_yday
+				   - isleap (tim_p->tm_year
+					     + (YEAR_BASE - 1
+						- (tim_p->tm_year < 0
+						   ? 0 : 2000)))));
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt != CQ('O') || !*alt_digits
+		|| !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					       week, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	      len = snprintf (&s[count], maxsize - count, CQ("%.2d"), week);
+            CHECK_LENGTH ();
+	  }
+          break;
+	case CQ('w'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == CQ('O') && *alt_digits)
+	    {
+	      len = conv_to_alt_digits (&s[count], maxsize - count,
+					tim_p->tm_wday, *alt_digits);
+	      CHECK_LENGTH ();
+	      if (len > 0)
+		break;
+	    }
+#endif /* _WANT_C99_TIME_FORMATS */
+	  if (count < maxsize - 1)
+            s[count++] = CQ('0') + tim_p->tm_wday;
+	  else
+	    return 0;
+	  break;
+	case CQ('W'):
+	  {
+	    int wday = (tim_p->tm_wday) ? tim_p->tm_wday - 1 : 6;
+	    wday = (tim_p->tm_yday + 7 - wday) / 7;
+#ifdef _WANT_C99_TIME_FORMATS
+	    if (alt != CQ('O') || !*alt_digits
+		|| !(len = conv_to_alt_digits (&s[count], maxsize - count,
+					       wday, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+	      len = snprintf (&s[count], maxsize - count, CQ("%.2d"), wday);
+            CHECK_LENGTH ();
+	  }
+	  break;
+	case CQ('y'):
+	    {
+#ifdef _WANT_C99_TIME_FORMATS
+	      if (alt == 'E' && *era_info)
+		len = snprintf (&s[count], maxsize - count, CQ("%d"),
+				(*era_info)->year);
+	      else
+#endif /* _WANT_C99_TIME_FORMATS */
+		{
+		  /* Be careful of both overflow and negative years, thanks to
+		     the asymmetric range of years.  */
+		  int year = tim_p->tm_year >= 0 ? tim_p->tm_year % 100
+			     : abs (tim_p->tm_year + YEAR_BASE) % 100;
+#ifdef _WANT_C99_TIME_FORMATS
+		  if (alt != CQ('O') || !*alt_digits
+		      || !(len = conv_to_alt_digits (&s[count], maxsize - count,
+						     year, *alt_digits)))
+#endif /* _WANT_C99_TIME_FORMATS */
+		    len = snprintf (&s[count], maxsize - count, CQ("%.2d"),
+				    year);
+		}
+              CHECK_LENGTH ();
+	    }
+	  break;
+	case CQ('Y'):
+#ifdef _WANT_C99_TIME_FORMATS
+	  if (alt == 'E' && *era_info)
+	    {
+	      ctloc = (*era_info)->era_Y;
+	      goto recurse;
+	    }
+	  else
+#endif /* _WANT_C99_TIME_FORMATS */
+	    {
+	      CHAR fmtbuf[10], *fmt = fmtbuf;
+	      int sign = tim_p->tm_year < -YEAR_BASE;
+	      /* int potentially overflows, so use unsigned instead.  */
+	      register unsigned year = (unsigned) tim_p->tm_year
+				       + (unsigned) YEAR_BASE;
+	      if (sign)
+		{
+		  *fmt++ = CQ('-');
+		  year = UINT_MAX - year + 1;
+		}
+	      else if (pad == CQ('+') && year >= 10000)
+		{
+		  *fmt++ = CQ('+');
+		  sign = 1;
+		}
+	      if (width && sign)
+		--width;
+	      *fmt++ = CQ('%');
+	      if (pad)
+		*fmt++ = CQ('0');
+	      STRCPY (fmt, CQ(".*u"));
+	      len = snprintf (&s[count], maxsize - count, fmtbuf, width,
+			      year);
+	      CHECK_LENGTH ();
+	    }
+	  break;
+	case CQ('z'):
+          if (tim_p->tm_isdst >= 0)
+            {
+	      long offset;
+
+	      TZ_LOCK;
+	      if (!tzset_called)
+		{
+		  _tzset_unlocked ();
+		  tzset_called = 1;
+		}
+
+#if defined (__CYGWIN__)
+	      /* Cygwin must check if the application has been built with or
+		 without the extra tm members for backward compatibility, and
+		 then use either that or the old method fetching from tzinfo.
+		 Rather than pulling in the version check infrastructure, we
+		 just call a Cygwin function. */
+	      extern long __cygwin_gettzoffset (const struct tm *tmp);
+	      offset = __cygwin_gettzoffset (tim_p);
+#elif defined (__TM_GMTOFF)
+	      offset = tim_p->__TM_GMTOFF;
+#else
+	      __tzinfo_type *tz = __gettzinfo ();
+	      /* The sign of this is exactly opposite the envvar TZ.  We
+		 could directly use the global _timezone for tm_isdst==0,
+		 but have to use __tzrule for daylight savings.  */
+	      offset = -tz->__tzrule[tim_p->tm_isdst > 0].offset;
+#endif
+	      TZ_UNLOCK;
+	      len = snprintf (&s[count], maxsize - count, CQ("%+03ld%.2ld"),
+			      offset / SECSPERHOUR,
+			      labs (offset / SECSPERMIN) % 60L);
+              CHECK_LENGTH ();
+            }
+          break;
+	case CQ('Z'):
+	  if (tim_p->tm_isdst >= 0)
+	    {
+	      size_t size;
+	      const char *tznam = NULL;
+
+	      TZ_LOCK;
+	      if (!tzset_called)
+		{
+		  _tzset_unlocked ();
+		  tzset_called = 1;
+		}
+#if defined (__CYGWIN__)
+	      /* See above. */
+	      extern const char *__cygwin_gettzname (const struct tm *tmp);
+	      tznam = __cygwin_gettzname (tim_p);
+#elif defined (__TM_ZONE)
+	      tznam = tim_p->__TM_ZONE;
+#endif
+	      if (!tznam)
+		tznam = _tzname[tim_p->tm_isdst > 0];
+	      /* Note that in case of wcsftime this loop only works for
+	         timezone abbreviations using the portable codeset (aka ASCII).
+		 This seems to be the case, but if that ever changes, this
+		 loop needs revisiting. */
+	      size = strlen (tznam);
+	      for (i = 0; i < size; i++)
+		{
+		  if (count < maxsize - 1)
+		    s[count++] = tznam[i];
+		  else
+		    {
+		      TZ_UNLOCK;
+		      return 0;
+		    }
+		}
+	      TZ_UNLOCK;
+	    }
+	  break;
+	case CQ('%'):
+	  if (count < maxsize - 1)
+	    s[count++] = CQ('%');
+	  else
+	    return 0;
+	  break;
+	default:
+	  return 0;
+	}
+      if (*format)
+	format++;
+      else
+	break;
+    }
+  if (maxsize)
+    s[count] = CQ('\0');
+
+  return count;
+}
+
+/* The remainder of this file can serve as a regression test.  Compile
+ *  with -D_REGRESSION_TEST.  */
+#if defined(_REGRESSION_TEST)	/* [Test code:  */
+
+/* This test code relies on ANSI C features, in particular on the ability
+ * of adjacent strings to be pasted together into one string.  */
+
+/* Test output buffer size (should be larger than all expected results) */
+#define OUTSIZE	256
+
+struct test {
+	CHAR  *fmt;	/* Testing format */
+	size_t  max;	/* Testing maxsize */
+	size_t	ret;	/* Expected return value */
+	CHAR  *out;	/* Expected output string */
+	};
+struct list {
+	const struct tm  *tms;	/* Time used for these vectors */
+	const struct test *vec;	/* Test vectors */
+	int  cnt;		/* Number of vectors */
+	};
+
+const char  TZ[]="TZ=EST5EDT";
+
+/* Define list of test inputs and expected outputs, for the given time zone
+ * and time.  */
+const struct tm  tm0 = {
+	/* Tue Dec 30 10:53:47 EST 2008 (time_t=1230648827) */
+	.tm_sec 	= 47,
+	.tm_min 	= 53,
+	.tm_hour	= 9,
+	.tm_mday	= 30,
+	.tm_mon 	= 11,
+	.tm_year	= 108,
+	.tm_wday	= 2,
+	.tm_yday	= 364,
+	.tm_isdst	= 0
+	};
+const struct test  Vec0[] = {
+	/* Testing fields one at a time, expecting to pass, using exact
+	 * allowed length as what is needed.  */
+	/* Using tm0 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%a"), 3+1, EXP(CQ("Tue")) },
+	{ CQ("%A"), 7+1, EXP(CQ("Tuesday")) },
+	{ CQ("%b"), 3+1, EXP(CQ("Dec")) },
+	{ CQ("%B"), 8+1, EXP(CQ("December")) },
+	{ CQ("%c"), 24+1, EXP(CQ("Tue Dec 30 09:53:47 2008")) },
+	{ CQ("%C"), 2+1, EXP(CQ("20")) },
+	{ CQ("%d"), 2+1, EXP(CQ("30")) },
+	{ CQ("%D"), 8+1, EXP(CQ("12/30/08")) },
+	{ CQ("%e"), 2+1, EXP(CQ("30")) },
+	{ CQ("%F"), 10+1, EXP(CQ("2008-12-30")) },
+	{ CQ("%g"), 2+1, EXP(CQ("09")) },
+	{ CQ("%G"), 4+1, EXP(CQ("2009")) },
+	{ CQ("%h"), 3+1, EXP(CQ("Dec")) },
+	{ CQ("%H"), 2+1, EXP(CQ("09")) },
+	{ CQ("%I"), 2+1, EXP(CQ("09")) },
+	{ CQ("%j"), 3+1, EXP(CQ("365")) },
+	{ CQ("%k"), 2+1, EXP(CQ(" 9")) },
+	{ CQ("%l"), 2+1, EXP(CQ(" 9")) },
+	{ CQ("%m"), 2+1, EXP(CQ("12")) },
+	{ CQ("%M"), 2+1, EXP(CQ("53")) },
+	{ CQ("%n"), 1+1, EXP(CQ("\n")) },
+	{ CQ("%p"), 2+1, EXP(CQ("AM")) },
+	{ CQ("%r"), 11+1, EXP(CQ("09:53:47 AM")) },
+	{ CQ("%R"), 5+1, EXP(CQ("09:53")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1230648827")) },
+	{ CQ("%S"), 2+1, EXP(CQ("47")) },
+	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
+	{ CQ("%T"), 8+1, EXP(CQ("09:53:47")) },
+	{ CQ("%u"), 1+1, EXP(CQ("2")) },
+	{ CQ("%U"), 2+1, EXP(CQ("52")) },
+	{ CQ("%V"), 2+1, EXP(CQ("01")) },
+	{ CQ("%w"), 1+1, EXP(CQ("2")) },
+	{ CQ("%W"), 2+1, EXP(CQ("52")) },
+	{ CQ("%x"), 8+1, EXP(CQ("12/30/08")) },
+	{ CQ("%X"), 8+1, EXP(CQ("09:53:47")) },
+	{ CQ("%y"), 2+1, EXP(CQ("08")) },
+	{ CQ("%Y"), 4+1, EXP(CQ("2008")) },
+	{ CQ("%z"), 5+1, EXP(CQ("-0500")) },
+	{ CQ("%Z"), 3+1, EXP(CQ("EST")) },
+	{ CQ("%%"), 1+1, EXP(CQ("%")) },
+	#undef EXP
+	};
+/* Define list of test inputs and expected outputs, for the given time zone
+ * and time.  */
+const struct tm  tm1 = {
+	/* Wed Jul  2 23:01:13 EDT 2008 (time_t=1215054073) */
+	.tm_sec 	= 13,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= 108,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+const struct test  Vec1[] = {
+	/* Testing fields one at a time, expecting to pass, using exact
+	 * allowed length as what is needed.  */
+	/* Using tm1 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%a"), 3+1, EXP(CQ("Wed")) },
+	{ CQ("%A"), 9+1, EXP(CQ("Wednesday")) },
+	{ CQ("%b"), 3+1, EXP(CQ("Jul")) },
+	{ CQ("%B"), 4+1, EXP(CQ("July")) },
+	{ CQ("%c"), 24+1, EXP(CQ("Wed Jul  2 23:01:13 2008")) },
+	{ CQ("%C"), 2+1, EXP(CQ("20")) },
+	{ CQ("%d"), 2+1, EXP(CQ("02")) },
+	{ CQ("%D"), 8+1, EXP(CQ("07/02/08")) },
+	{ CQ("%e"), 2+1, EXP(CQ(" 2")) },
+	{ CQ("%F"), 10+1, EXP(CQ("2008-07-02")) },
+	{ CQ("%g"), 2+1, EXP(CQ("08")) },
+	{ CQ("%G"), 4+1, EXP(CQ("2008")) },
+	{ CQ("%h"), 3+1, EXP(CQ("Jul")) },
+	{ CQ("%H"), 2+1, EXP(CQ("23")) },
+	{ CQ("%I"), 2+1, EXP(CQ("11")) },
+	{ CQ("%j"), 3+1, EXP(CQ("184")) },
+	{ CQ("%k"), 2+1, EXP(CQ("23")) },
+	{ CQ("%l"), 2+1, EXP(CQ("11")) },
+	{ CQ("%m"), 2+1, EXP(CQ("07")) },
+	{ CQ("%M"), 2+1, EXP(CQ("01")) },
+	{ CQ("%n"), 1+1, EXP(CQ("\n")) },
+	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
+	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
+	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
+	{ CQ("%S"), 2+1, EXP(CQ("13")) },
+	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
+	{ CQ("%T"), 8+1, EXP(CQ("23:01:13")) },
+	{ CQ("%u"), 1+1, EXP(CQ("3")) },
+	{ CQ("%U"), 2+1, EXP(CQ("26")) },
+	{ CQ("%V"), 2+1, EXP(CQ("27")) },
+	{ CQ("%w"), 1+1, EXP(CQ("3")) },
+	{ CQ("%W"), 2+1, EXP(CQ("26")) },
+	{ CQ("%x"), 8+1, EXP(CQ("07/02/08")) },
+	{ CQ("%X"), 8+1, EXP(CQ("23:01:13")) },
+	{ CQ("%y"), 2+1, EXP(CQ("08")) },
+	{ CQ("%Y"), 4+1, EXP(CQ("2008")) },
+	{ CQ("%z"), 5+1, EXP(CQ("-0400")) },
+	{ CQ("%Z"), 3+1, EXP(CQ("EDT")) },
+	{ CQ("%%"), 1+1, EXP(CQ("%")) },
+	#undef EXP
+	#define VEC(s)	s, sizeof(s)/sizeof(CHAR), sizeof(s)/sizeof(CHAR)-1, s
+	#define EXP(s)	sizeof(s)/sizeof(CHAR), sizeof(s)/sizeof(CHAR)-1, s
+	{ VEC(CQ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) },
+	{ CQ("0123456789%%%h:`~"), EXP(CQ("0123456789%Jul:`~")) },
+	{ CQ("%R%h:`~ %x %w"), EXP(CQ("23:01Jul:`~ 07/02/08 3")) },
+	#undef VEC
+	#undef EXP
+	};
+
+#if YEAR_BASE == 1900  /* ( */
+/* Checks for very large years.  YEAR_BASE value relied upon so that the
+ * answer strings can be predetermined.
+ * Years more than 4 digits are not mentioned in the standard for %C, so the
+ * test for those cases are based on the design intent (which is to print the
+ * whole number, being the century).  */
+const struct tm  tmyr0 = {
+	/* Wed Jul  2 23:01:13 EDT [HUGE#] */
+	.tm_sec 	= 13,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= INT_MAX - YEAR_BASE/2,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#if INT_MAX == 32767
+#  define YEAR	CQ("33717")		/* INT_MAX + YEAR_BASE/2 */
+#  define CENT	CQ("337")
+#  define Year	   CQ("17")
+# elif INT_MAX == 2147483647
+#  define YEAR	CQ("2147484597")
+#  define CENT	CQ("21474845")
+#  define Year	        CQ("97")
+# elif INT_MAX == 9223372036854775807
+#  define YEAR	CQ("9223372036854776757")
+#  define CENT	CQ("92233720368547777")
+#  define Year	                 CQ("57")
+# else
+#  error "Unrecognized INT_MAX value:  enhance me to recognize what you have"
+#endif
+const struct test  Vecyr0[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyr0 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:13 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+/* Checks for very large negative years.  YEAR_BASE value relied upon so that
+ * the answer strings can be predetermined.  */
+const struct tm  tmyr1 = {
+	/* Wed Jul  2 23:01:13 EDT [HUGE#] */
+	.tm_sec 	= 13,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= INT_MIN,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#if INT_MAX == 32767
+#  define YEAR	CQ("-30868")		/* INT_MIN + YEAR_BASE */
+#  define CENT	CQ("-308")
+#  define Year	    CQ("68")
+# elif INT_MAX == 2147483647
+#  define YEAR	CQ("-2147481748")
+#  define CENT	CQ("-21474817")
+#  define Year	         CQ("48")
+# elif INT_MAX == 9223372036854775807
+#  define YEAR	CQ("-9223372036854773908")
+#  define CENT	CQ("-92233720368547739")
+#  define Year	                  CQ("08")
+# else
+#  error "Unrecognized INT_MAX value:  enhance me to recognize what you have"
+#endif
+const struct test  Vecyr1[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyr1 for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:13 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+#endif /* YEAR_BASE ) */
+
+/* Checks for years just over zero (also test for s=60).
+ * Years less than 4 digits are not mentioned for %Y in the standard, so the
+ * test for that case is based on the design intent.  */
+const struct tm  tmyrzp = {
+	/* Wed Jul  2 23:01:60 EDT 0007 */
+	.tm_sec 	= 60,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= 7-YEAR_BASE,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#define YEAR	CQ("0007")	/* Design intent:  %Y=%C%y */
+#define CENT	CQ("00")
+#define Year	  CQ("07")
+const struct test  Vecyrzp[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyrzp for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:60 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+/* Checks for years just under zero.
+ * Negative years are not handled by the standard, so the vectors here are
+ * verifying the chosen implemtation.  */
+const struct tm  tmyrzn = {
+	/* Wed Jul  2 23:01:00 EDT -004 */
+	.tm_sec 	= 00,
+	.tm_min 	= 1,
+	.tm_hour	= 23,
+	.tm_mday	= 2,
+	.tm_mon 	= 6,
+	.tm_year	= -4-YEAR_BASE,
+	.tm_wday	= 3,
+	.tm_yday	= 183,
+	.tm_isdst	= 1
+	};
+#define YEAR	CQ("-004")
+#define CENT	CQ("-0")
+#define Year	  CQ("04")
+const struct test  Vecyrzn[] = {
+	/* Testing fields one at a time, expecting to pass, using a larger
+	 * allowed length than what is needed.  */
+	/* Using tmyrzn for time: */
+	#define EXP(s)	sizeof(s)/sizeof(CHAR)-1, s
+	{ CQ("%C"), OUTSIZE, EXP(CENT) },
+	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:00 ")YEAR) },
+	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
+	{ CQ("%y"), OUTSIZE, EXP(Year) },
+	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
+	#undef EXP
+	};
+#undef YEAR
+#undef CENT
+#undef Year
+
+const struct list  ListYr[] = {
+	{ &tmyrzp, Vecyrzp, sizeof(Vecyrzp)/sizeof(Vecyrzp[0]) },
+	{ &tmyrzn, Vecyrzn, sizeof(Vecyrzn)/sizeof(Vecyrzn[0]) },
+	#if YEAR_BASE == 1900
+	{ &tmyr0, Vecyr0, sizeof(Vecyr0)/sizeof(Vecyr0[0]) },
+	{ &tmyr1, Vecyr1, sizeof(Vecyr1)/sizeof(Vecyr1[0]) },
+	#endif
+	};
+
+
+/* List of tests to be run */
+const struct list  List[] = {
+	{ &tm0, Vec0, sizeof(Vec0)/sizeof(Vec0[0]) },
+	{ &tm1, Vec1, sizeof(Vec1)/sizeof(Vec1[0]) },
+	};
+
+#if defined(STUB_getenv_r)
+char *
+_getenv_r(struct _reent *p, const char *cp) { return getenv(cp); }
+#endif
+
+int
+main(void)
+{
+int  i, l, errr=0, erro=0, tot=0;
+const char  *cp;
+CHAR  out[OUTSIZE];
+size_t  ret;
+
+/* Set timezone so that %z and %Z tests come out right */
+cp = TZ;
+if((i=putenv(cp)))  {
+    printf( "putenv(%s) FAILED, ret %d\n", cp, i);
+    return(-1);
+    }
+if(strcmp(getenv("TZ"),strchr(TZ,'=')+1))  {
+    printf( "TZ not set properly in environment\n");
+    return(-2);
+    }
+tzset();
+
+#if defined(VERBOSE)
+printf("_timezone=%d, _daylight=%d, _tzname[0]=%s, _tzname[1]=%s\n", _timezone, _daylight, _tzname[0], _tzname[1]);
+{
+long offset;
+__tzinfo_type *tz = __gettzinfo ();
+/* The sign of this is exactly opposite the envvar TZ.  We
+   could directly use the global _timezone for tm_isdst==0,
+   but have to use __tzrule for daylight savings.  */
+printf("tz->__tzrule[0].offset=%d, tz->__tzrule[1].offset=%d\n", tz->__tzrule[0].offset, tz->__tzrule[1].offset);
+}
+#endif
+
+/* Run all of the exact-length tests as-given--results should match */
+for(l=0; l<sizeof(List)/sizeof(List[0]); l++)  {
+    const struct list  *test = &List[l];
+    for(i=0; i<test->cnt; i++)  {
+	tot++;	/* Keep track of number of tests */
+	ret = strftime(out, test->vec[i].max, test->vec[i].fmt, test->tms);
+	if(ret != test->vec[i].ret)  {
+	    errr++;
+	    fprintf(stderr,
+		"ERROR:  return %d != %d expected for List[%d].vec[%d]\n",
+						ret, test->vec[i].ret, l, i);
+	    }
+	if(strncmp(out, test->vec[i].out, test->vec[i].max-1))  {
+	    erro++;
+	    fprintf(stderr,
+		"ERROR:  \"%"SFLG"s\" != \"%"SFLG"s\" expected for List[%d].vec[%d]\n",
+						out, test->vec[i].out, l, i);
+	    }
+	}
+    }
+
+/* Run all of the exact-length tests with the length made too short--expect to
+ * fail.  */
+for(l=0; l<sizeof(List)/sizeof(List[0]); l++)  {
+    const struct list  *test = &List[l];
+    for(i=0; i<test->cnt; i++)  {
+	tot++;	/* Keep track of number of tests */
+	ret = strftime(out, test->vec[i].max-1, test->vec[i].fmt, test->tms);
+	if(ret != 0)  {
+	    errr++;
+	    fprintf(stderr,
+		"ERROR:  return %d != %d expected for List[%d].vec[%d]\n",
+						ret, 0, l, i);
+	    }
+	/* Almost every conversion puts out as many characters as possible, so
+	 * go ahead and test the output even though have failed.  (The test
+	 * times chosen happen to not hit any of the cases that fail this, so it
+	 * works.)  */
+	if(strncmp(out, test->vec[i].out, test->vec[i].max-1-1))  {
+	    erro++;
+	    fprintf(stderr,
+		"ERROR:  \"%"SFLG"s\" != \"%"SFLG"s\" expected for List[%d].vec[%d]\n",
+						out, test->vec[i].out, l, i);
+	    }
+	}
+    }
+
+/* Run all of the special year test cases */
+for(l=0; l<sizeof(ListYr)/sizeof(ListYr[0]); l++)  {
+    const struct list  *test = &ListYr[l];
+    for(i=0; i<test->cnt; i++)  {
+	tot++;	/* Keep track of number of tests */
+	ret = strftime(out, test->vec[i].max, test->vec[i].fmt, test->tms);
+	if(ret != test->vec[i].ret)  {
+	    errr++;
+	    fprintf(stderr,
+		"ERROR:  return %d != %d expected for ListYr[%d].vec[%d]\n",
+						ret, test->vec[i].ret, l, i);
+	    }
+	if(strncmp(out, test->vec[i].out, test->vec[i].max-1))  {
+	    erro++;
+	    fprintf(stderr,
+		"ERROR:  \"%"SFLG"s\" != \"%"SFLG"s\" expected for ListYr[%d].vec[%d]\n",
+						out, test->vec[i].out, l, i);
+	    }
+	}
+    }
+
+#define STRIZE(f)	#f
+#define NAME(f)	STRIZE(f)
+printf(NAME(strftime) "() test ");
+if(errr || erro)  printf("FAILED %d/%d of", errr, erro);
+  else    printf("passed");
+printf(" %d test cases.\n", tot);
+
+return(errr || erro);
+}
+#endif /* defined(_REGRESSION_TEST) ] */

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-22 10:29   ` Corinna Vinschen
@ 2015-10-26 10:50     ` Corinna Vinschen
  2015-10-26 23:11       ` Brian Inglis
  0 siblings, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2015-10-26 10:50 UTC (permalink / raw)
  To: cygwin; +Cc: Brian Inglis

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]

Brian, ping?

On Oct 22 10:46, Corinna Vinschen wrote:
> Hi Brian,
> 
> On Oct 22 07:03, Brian Inglis wrote:
> > Brian Inglis <Brian.Inglis <at> SystematicSw.ab.ca> writes:
> > 
> > > 
> > > Don Harrop <don <at> effx.us> writes:
> > > > Bash outputs no value when using it's built in method of printing an 
> > > > "epoch" timestamp.
> > > > BashCommandLine#: printf '%(%s)T' -1
> > > 
> > > bash printf depends on underlying strftime in newlib, which does not support
> > > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
> > > is presumably not defined in the config, as %s is not shown in man strftime. 
> > > Workaround for now is use 
> > >     date +%s 
> > > for current time, and 
> > >    date -d $(printf '%(%T)T' -2) +%s
> > > for shell invocation time.
> > 
> > > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
> > Wrong! Misread the code, strftime %s is not supported! 
> > 
> > STC and suggested patch appended (posting from gmane), compiles, but can't
> > build STC as ld fails with undef refs, and I don't know all the correct
> > LD..., -L and -l incantations. Email me for original files. 
> 
> Cool, thanks for the patch.  Unfortunately it doesn't apply cleanly.
> There are several unexpected line wraps and there's this:
> 
> > --- a/newlib/time/strftime.c        2015-08-20 03:39:24.000000000 -0600
> > +++ b/newlib/time/strftime.c        2015-10-21 20:15:22.367453000 -0600
> 
> How did this happen?  If you checkout the newlib-cygwin git repo,
> strftime.c is under newlib/libc/time, not under newlib/time :o
> 
> Would you mind to attach a patch generated with git format-patch?
> 
> 
> Thanks in advance,
> Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-22  8:46 ` Brian Inglis
@ 2015-10-22 10:29   ` Corinna Vinschen
  2015-10-26 10:50     ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2015-10-22 10:29 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1750 bytes --]

Hi Brian,

On Oct 22 07:03, Brian Inglis wrote:
> Brian Inglis <Brian.Inglis <at> SystematicSw.ab.ca> writes:
> 
> > 
> > Don Harrop <don <at> effx.us> writes:
> > > Bash outputs no value when using it's built in method of printing an 
> > > "epoch" timestamp.
> > > BashCommandLine#: printf '%(%s)T' -1
> > 
> > bash printf depends on underlying strftime in newlib, which does not support
> > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
> > is presumably not defined in the config, as %s is not shown in man strftime. 
> > Workaround for now is use 
> >     date +%s 
> > for current time, and 
> >    date -d $(printf '%(%T)T' -2) +%s
> > for shell invocation time.
> 
> > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
> Wrong! Misread the code, strftime %s is not supported! 
> 
> STC and suggested patch appended (posting from gmane), compiles, but can't
> build STC as ld fails with undef refs, and I don't know all the correct
> LD..., -L and -l incantations. Email me for original files. 

Cool, thanks for the patch.  Unfortunately it doesn't apply cleanly.
There are several unexpected line wraps and there's this:

> --- a/newlib/time/strftime.c        2015-08-20 03:39:24.000000000 -0600
> +++ b/newlib/time/strftime.c        2015-10-21 20:15:22.367453000 -0600

How did this happen?  If you checkout the newlib-cygwin git repo,
strftime.c is under newlib/libc/time, not under newlib/time :o

Would you mind to attach a patch generated with git format-patch?


Thanks in advance,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
  2015-10-22  7:04 Brian Inglis
@ 2015-10-22  8:46 ` Brian Inglis
  2015-10-22 10:29   ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Inglis @ 2015-10-22  8:46 UTC (permalink / raw)
  To: cygwin

Brian Inglis <Brian.Inglis <at> SystematicSw.ab.ca> writes:

> 
> Don Harrop <don <at> effx.us> writes:
> > Bash outputs no value when using it's built in method of printing an 
> > "epoch" timestamp.
> > BashCommandLine#: printf '%(%s)T' -1
> 
> bash printf depends on underlying strftime in newlib, which does not support
> %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
> is presumably not defined in the config, as %s is not shown in man strftime. 
> Workaround for now is use 
>     date +%s 
> for current time, and 
>    date -d $(printf '%(%T)T' -2) +%s
> for shell invocation time.

> %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
Wrong! Misread the code, strftime %s is not supported! 

STC and suggested patch appended (posting from gmane), compiles, but can't
build STC as ld fails with undef refs, and I don't know all the correct
LD..., -L and -l incantations. Email me for original files. 

/* newlib/time/strftime.c %s format STC */
#include <stdio.h>
#include <time.h>

int main( int argc, char **argv) {
    char ss[BUFSIZ]     = "";
    time_t tt           = time( NULL );
    struct tm *tp       = gmtime( &tt );
    tt                  = mktime( tp );
    size_t st           = strftime( ss, sizeof ss, "%s", tp);
    int rc              = puts( ss );
    st                  = strftime( ss, sizeof ss, "%T", tp);
    rc                  = puts( ss );
    return rc;
}

--- 8< ---
2015-10-12  Brian Inglis  <Brian.Inglis@SystematicSw.ab.ca>
* newlib/time/strftime.c (__strftime): add support for %s (seconds from Unix
epoch)

--- a/newlib/time/strftime.c        2015-08-20 03:39:24.000000000 -0600
+++ b/newlib/time/strftime.c        2015-10-21 20:15:22.367453000 -0600
@@ -166,6 +166,10 @@ notations, the result is an empty string
 o %R
 The 24-hour time, to the minute.  Equivalent to "%H:%M". [tm_min, tm_hour]

+o %s
+The time elapsed, in seconds, since the start of the Unix epoch at
+1970-01-01 00:00:00 UTC.
+
 o %S
 The second, formatted with two digits (from `<<00>>' to `<<60>>').  The
 value 60 accounts for the occasional leap second. [tm_sec]
@@ -1109,6 +1113,74 @@ recurse:
                          tim_p->tm_hour, tim_p->tm_min);
           CHECK_LENGTH ();
           break;
+       case CQ('s'):
+/*
+ * From:
+ * The Open Group Base Specifications Issue 7
+ * IEEE Std 1003.1, 2013 Edition
+ * Copyright (c) 2001-2013 The IEEE and The Open Group
+ * XBD Base Definitions
+ * 4. General Concepts
+ * 4.15 Seconds Since the Epoch
+ * A value that approximates the number of seconds that have elapsed since the
+ * Epoch. A Coordinated Universal Time name (specified in terms of seconds
+ * (tm_sec), minutes (tm_min), hours (tm_hour), days since January 1 of the
year
+ * (tm_yday), and calendar year minus 1900 (tm_year)) is related to a time
+ * represented as seconds since the Epoch, according to the expression below.
+ * If the year is <1970 or the value is negative, the relationship is
undefined.
+ * If the year is >=1970 and the value is non-negative, the value is
related to a
+ * Coordinated Universal Time name according to the C-language expression,
where
+ * tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all integer types:
+ * tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
+ *     (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
+ *     ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
+ * OR
+ * ((((tm_year-69)/4 - (tm_year-1)/100 + (tm_year+299)/400 +
+ *         (tm_year-70)*365 + tm_yday)*24 + tm_hour)*60 + tm_min)*60 + tm_sec
+ */
+/* modified from %z case by hoisting offset outside if block and
initializing */
+         {
+           long offset;        /* offset < 0 => W of GMT, > 0 => E of GMT:
+           offset = 0;    subtract to get UTC */
+
+           if (tim_p->tm_isdst >= 0)
+             {
+               TZ_LOCK;
+               if (!tzset_called)
+                 {
+                   _tzset_unlocked ();
+                   tzset_called = 1;
+                 }
+
+#if defined (__CYGWIN__)
+               /* Cygwin must check if the application has been built with or
+                  without the extra tm members for backward compatibility, and
+                  then use either that or the old method fetching from tzinfo.
+                  Rather than pulling in the version check infrastructure, we
+                  just call a Cygwin function. */
+               extern long __cygwin_gettzoffset (const struct tm *tmp);
+               offset = __cygwin_gettzoffset (tim_p);
+#elif defined (__TM_GMTOFF)
+               offset = tim_p->__TM_GMTOFF;
+#else
+               __tzinfo_type *tz = __gettzinfo ();
+               /* The sign of this is exactly opposite the envvar TZ.  We
+                  could directly use the global _timezone for tm_isdst==0,
+                  but have to use __tzrule for daylight savings.  */
+               offset = -tz->__tzrule[tim_p->tm_isdst > 0].offset;
+#endif
+               TZ_UNLOCK;
+             }
+           len = snprintf (&s[count], maxsize - count, CQ("%lld"),
+                           (((((long long)tim_p->tm_year - 69)/4
+                               - (tim_p->tm_year - 1)/100
+                               + (tim_p->tm_year + 299)/400
+                               + (tim_p->tm_year - 70)*365 + tim_p->tm_yday)*24
+                             + tim_p->tm_hour)*60 + tim_p->tm_min)*60
+                           + tim_p->tm_sec - offset);
+           CHECK_LENGTH ();
+         }
+          break;
        case CQ('S'):
 #ifdef _WANT_C99_TIME_FORMATS
          if (alt != CQ('O') || !*alt_digits
@@ -1442,6 +1514,7 @@ const struct test  Vec0[] = {
        { CQ("%p"), 2+1, EXP(CQ("AM")) },
        { CQ("%r"), 11+1, EXP(CQ("09:53:47 AM")) },
        { CQ("%R"), 5+1, EXP(CQ("09:53")) },
+       { CQ("%s"), 2+1, EXP(CQ("1230648827")) },
        { CQ("%S"), 2+1, EXP(CQ("47")) },
        { CQ("%t"), 1+1, EXP(CQ("\t")) },
        { CQ("%T"), 8+1, EXP(CQ("09:53:47")) },



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Bash unable to print epoch timestamp
@ 2015-10-22  7:04 Brian Inglis
  2015-10-22  8:46 ` Brian Inglis
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Inglis @ 2015-10-22  7:04 UTC (permalink / raw)
  To: cygwin

Don Harrop <don <at> effx.us> writes:
> Bash outputs no value when using it's built in method of printing an 
> "epoch" timestamp.
> BashCommandLine#: printf '%(%s)T' -1

bash printf depends on underlying strftime in newlib, which does not support
%s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
is presumably not defined in the config, as %s is not shown in man strftime. 
Workaround for now is use 
    date +%s 
for current time, and 
   date -d $(printf '%(%T)T' -2) +%s
for shell invocation time.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-10-29  7:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-21 12:25 chere 1.4 bug(?) - "Bash Prompt Here" not shown under Libraries folders cpengr
2015-10-21 16:51 ` Achim Gratz
2015-10-21 18:01   ` cpengr
2015-10-21 18:05     ` Bash unable to print epoch timestamp Don Harrop
2015-10-22  7:04 Brian Inglis
2015-10-22  8:46 ` Brian Inglis
2015-10-22 10:29   ` Corinna Vinschen
2015-10-26 10:50     ` Corinna Vinschen
2015-10-26 23:11       ` Brian Inglis
     [not found] <562A996C.9070904@SystematicSw.ab.ca>
2015-10-26 19:54 ` Brian Inglis
2015-10-26 20:22   ` Brian Inglis
2015-10-27  9:27   ` Brian Inglis
2015-10-27  9:28     ` Brian Inglis
2015-10-27  9:54     ` Corinna Vinschen
2015-10-29  2:50       ` Brian Inglis
2015-10-29  8:19         ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).