Setting 'struct tm' tm_zone="GMT" doesn't work, takes default system timezone

Dear Dev-Meisters,
I'm trying to find out why setting  tm_zone="GMT" in a "struct tm" is not working on Mac OS X 10.6.x. and mktime()....
However with gmtime() it works but apparently it's not recommended for Mac OS X...
I need to read in a data file with large datasets which contains date / time along with data.
Every date/time (can be about > 500000 lines) is converted to a time_t data structure to find out if there a gaps between dates.
However setting the structure "struct tm" with tm_zone="GMT" doesn't set it to GMT.
It always takes Mac OS X default time zone defined in the Sys Preferences.
I made succesful tests with "NSDate timeIntervalSince1970" (when setting the NSTimezone to GMT): this gives the correct GMT time...
Since > 500000 lines is a little bit overkill performance wise to always create an object I would prefer to use UNIX time stamp...
/* Test for 24 Feb. 2005 at 17h20:10 / Should return: 1109265610 as UTC time */
time_t currentTime;
struct tm myTm;
myTm.tm_year          = 2005-1900;  // need to subtract -1900
myTm.tm_mon           = 2-1;        // need to subtract -1 (since month: 0-11) 
myTm.tm_mday          = 24;
myTm.tm_hour          = 17;
myTm.tm_min           = 20;
myTm.tm_sec           = 10;
myTm.tm_zone          = "GMT";
myTm.tm_isdst         = 0; // DayLight Saving Time flag = 0 = Off
myTm.tm_gmtoff        = 0;
currentTime = mktime(&myTm);
Result on Mac OS X: 1109262010 !! Wrong result: -3600 seconds, should be 1109265610
However using:
currentTime = gmtime(&myTm);
gives the right result: 1109265610
Any suggestions is greatly appreciated

Thanks for the answer, I read everything except the man page for mktime :-(
Well I can't remember where I read that about "gmtime" but you are right:
I will use gmtime instead of mktime and it works, it converts it to a GMT time.
Thanks again for your precious help.
Cheers,
Gilles

Similar Messages

  • My touchpad doesn't work on windows system after I upgrade the OS from window 8.0 to 8.1, can someone help me how to settle it, thanks,

    My touchpad doesn't work on windows system after I upgrade the OS from window 8.0 to 8.1, can someone help me how to settle it, thanks,

    Hi candy, glad that you found that Shockwave Flash Object, it works with the Flash files and is very important
    The NPSWF files that you said are not there, those are for the Firefox browser or Chrome or some other browser. If you use Firefox and want the Flash Player for that, then close all of your browsers so you are only looking at your Desktop.
    Click on this Flash Player Installer for Firefox and SAVE it to your Desktop. Then RUN it from your Desktop, and after it is finished Installing, Restart your computer.
    Then Using Firefox go to the plug-ins and find a SWF vs 10.0.45.2 and make sure it is Enabled. This is just like the Shockwave Flash Object for Internet Explorer, but it is the one that works with Firefox.
    Let me know if that is what you wanted to do. If you don't use Firefox, but Chrome or another browser, then this will work for that one also.
    If you don't use another browser, then don't do any of this. I just thot maybe you did and that is why you were concerned that the NPSWF files were not there.
    Thanks,
    eidnolb

  • After i empty trash (the secure empty doesn't work either), the system does not reclaim the free space.

    After i empty trash (the secure empty doesn't work either), the system does not reclaim the free space.
    I need to run the erase free space option from the disk utility every time...which is really annoying and time consuming.
    Any ideas how to solve this?
    Thanks in advance =)

    There is a thing in iPhoto whereby the first time you delete a photo it asks if you want to delete or just remove from the album, something like that.  Unfortunately it is one of these things with a "don't ask me again" checkbox.  Now, "deleting" photos only removes them from the album they are in.  To actually trash them I must then go to "all photos" and find them, to send them to the trash.   To help find them, what I do is rename them zzz or something, so sorting them will get them to the bottom of my collection.  Just maybe your photos are still lurking around?

  • Setting NLS_LANG=CANADIAN FRENCH_CANADA.WE8MSWIN1252 doesn't work Win64 bit

    Hi,
    I migrated my database Oracle 10.2.0.4 windows 32 bits to Windows 64 bits. On the new server 64 bits, I set registers key exactly the same way (NLS_LANG, NLS_DATE_FORMAT, etc.).
    In 32 bits, when I started SQLPlus, I had the following output:*
    +Microsoft Windows [Version 5.2.3790]+
    +(C) Copyright 1985-2003 Microsoft Corp.+
    D:\Logiciels\Oracle\Ora10g\rdbms\BIN>sqlplus /nolog
    SQL*Plus: Release 10.2.0.3.0 - Production on Jeu. Juil. 16 14:21:49 2009
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    SQL> show user
    USER est ""+
    SQL>
    In 64 bits, I had the following output when I started SQLPlus:*
    D:\Logiciels\oracle\ora10g\rdbms\BIN>sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.4.0 - Production on Jeu. Juil. 16 14:16:19 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    SQL> show user
    USER is "SYS"+
    SQL>
    To be sure it's the good key used by SQL*Plus, I voluntary changed the value of the Key NLS_LANG to an invalid value to see what would be the result
    (for example: I omitted the first "A" in CNADIAN FRENCH_CANADA.WE8MSWIN1252). Now is the result:
    D:\Logiciels\oracle\ora10g\rdbms\BIN>sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.4.0 - Production on Jeu. Juil. 16 14:22:40 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    ERROR:
    ORA-12705: Cannot access NLS data files or invalid environment specified
    Enter user-name:
    That's the proof that I'm using the good key. Si why it doesn't work for NLS_LANG=CANADIAN FRENCH_CANADA.WE8MSWIN1252 ???
    I tried with the same bad result with FRENCH_CANADA.WE8MSWIN1252.
    Any idea?
    Thank's
    Yves
    Edited by: yvesthib on 2009-07-16 14:33
    Sorry, I created the this thread in the wrong category ...

    I'm quoting NLS_LANG FAQ http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm:
    >
    If NLS_LANG is not set in the environment, check the value in the registry:
    SQL>@.[%NLS_LANG%].
    If you get something like:
    Unable to open file.[ENGLISH_UNITED KINGDOM.WE8ISO8859P1].
    The "file name" between the braces is the value of the registry parameter.
    If you get this as result:
    Unable to open file ".[%NLS_LANG%]." then the parameter NLS_LANG is also not set in the registry.
    Note the @.[%NLS_LANG%]. technique reports the NLS_LANG known by the SQL*Plus executable, it will not read the registry itself. But if you run the HOST command first and the NLS_LANG is not set in the environment then you can be sure the variable is set in the registry if the @.[%NLS_LANG%]. returns a valid value.
    >
    Maybe you have several NLS_LANG setting in the registry because you have several ORACLE_HOME ?
    Edited by: P. Forstmann on Jul 16, 2009 9:23 PM

  • Setting proxy from installation program doesn't work

    I think I found a bug in installation program.
    When I go to setup network in installation program, choose not to use dhcp and then setup the proxy configuration there it doesn't work.
    I know it's not a network problem or anything because I managed to install fine after going to another VC and using export http_proxy="myproxyip:port" and export ftp_proxy="myproxyip:port" and then returned to installation program on VC1.

    The best thing to do when you think you found a bug is to post in the bug tracker. Things have a tendency to get lost in the forums very quickly, as well a number of Arch developers don't come into the forums at all.

  • SunPKCS11 doesn't work as default keystore provider for SSL connections

    Hi all,
    I'm experiencing a problem using SunPKCS11 as a keystore provider for SSL.
    Below the code that doesn't work as expected:
    String pkcs11config = "name = " + "bit4id" + "\nlibrary = " + "c:/windows/system32/bit4p11.dll";
    byte[] pkcs11configBytes = pkcs11config.getBytes();
    ByteArrayInputStream configStream = new ByteArrayInputStream(
    pkcs11configBytes);
    AuthProvider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(
    configStream);
    pkcs11Provider.setCallbackHandler(new MyGuiCallbackHandler());
    if (Security.getProvider(pkcs11Provider.getName()) != null) {
    Security.removeProvider(pkcs11Provider.getName());
    Security.insertProviderAt(pkcs11Provider, 2);
    //Security.insertProviderAt(pkcs11Provider, 1);
    System.setProperty("javax.net.ssl.keyStoreProvider",
    pkcs11Provider.getName());
    System.setProperty("javax.net.ssl.keyStoreType",
    "PKCS11");
    System.setProperty("javax.net.ssl.keyStore",
    "NONE");
    KeyManager[] KM = {KeyStore.getInstance("PKCS11") };
    SSLContext sslcont = SSLContext.getInstance("SSL");
    sslcont.init(null  /*KM*/ , tmS, rng);If i use KM everything works fine, but if I try to initialize the sslcontext using the default keyStoreProvider (just replacing KM with null, and without any other modification to the code), it uses SUN instead of PKCS11, even if I set the system properties javax.net.ssl.keyStore* (as you can see in my code)
    Can anyone help me?
    Thank's in advance and happy new year,
    Patrizio

    That's what I tried first, but it didn't work.
    I followed instructions at
    http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/JSSERefGuide.html#CustomizingStores
    Then I found something about dynamic provider allocation at
    http://forum.java.sun.com/thread.jspa?forumID=2&threadID=5172412
    so I tried to dynamically allocate SunPKCS11-bit4id as a provider.
    Any suggestion?

  • Microsoft Update doesn't work after fresh System Restore

    I installed a new hard drive (WD Scorpio Black, 750gb) in my Pavillion DV6-2150US and used the original HP disks to do a clean Windows 7 install.  Now that I have installed the OS, the Windows update process doesn't work properly, and won't download updates.  As a result, I can't install the Service Pack, etc.
    I've tried the Microsoft troubleshooting steps for addressing the Windows Update issue, and they don't correct the problem.  ervices" says the Windows Update service is running, but when I try to run Microsoft Update, I get the message the service isn't running.
    I have tried the install from two different sets of HP disks, as well as the recovery disks I made when the computer was new.  I get the same results each time.
    Any thoughts as to what might be going on? 

    Hi
    You can try this go to the following link and install Operating System - Enhancements and QFEs
    Essential System Updates and see if it helps
    http://h10025.www1.hp.com/ewfrf/wc/softwareCategory?os=4063&lc=en&cc=us&dlc=en&sw_lang=&product=4121...
    You can also reffer to the following
    http://windows.microsoft.com/en-in/windows-vista/troubleshoot-problems-with-installing-updates
    http://support.microsoft.com/mats/windows_update/
    Hope this helps.
    ***** Click the KUDOS Thumbs UP (Like) on the left to say 'Thanks'*****
    ****Make it easier for other people to find solutions, by marking my answer “Accept as Solution”&"Kudos"if it solves your problem.****
    -VJ
    Although I am an HP Employee, I am speaking for myself and not for HP.

  • Premiere and After CC 2014 doesn't work on my system

    I installed Premiere and After CC 2014 on my computer, but doesn't work.
    When i open the app has stopped working.
    My system is Windows 7 Ultimate, 64 bits, 16gb ram, Intel core I7 3,5 Ghz.

    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840
    •What is your exact brand/model graphics adapter (ATI or nVidia or ???)
    •What is your exact graphics adapter driver version?
    •Have you gone to the vendor web site to check for a newer driver?
    •For Windows, do NOT rely on Windows Update to have current driver information
    •-you need to go direct to the vendor web site and check updates for yourself
    •ATI Driver Autodetect http://support.amd.com/en-us/download/auto-detect-tool
    •nVidia Driver Downloads http://www.nvidia.com/Download/index.aspx?lang=en-us

  • Setting HP LaserJet 2200d Duplex Doesn't work

    Machine is fully updated via Software Update as of 7/15/2008 (10.5.4), including the 7/15/08 HP Drivers.
    Printer: HP LaserJet 2200d
    Interface: USB
    Driver: /Library/Printers/PPDs/Contents/Resources/HP LaserJet 2200.gz
    I installed the printer and ensured it is using the correct driver.
    Open the print queue, select Info, select Driver, set the Duplex Unit checkbox and set the RAM to 8-15MB to match printer's 8MB RAM.
    Open any PDF using Preview.
    Command-P to print
    Set pages to print From 1 to 2 (to save resources, has no effect on this behavior)
    Open Layout
    Set Duplex to Long-edge binding
    press Print
    Resulting job is printed single-sided on two sheets.
    I use Preview and PDFs as an example application. Every application I have tried prints single-sided when long-edge is set.
    Interestingly, if I issue the following shell command, duplexing is properly enabled:
    lp -P 1-2 -o sides=two-sided-long-edge samefile.pdf
    Also, when I print to this print queue over the network from a Tiger 10.4.11 machine, duplexing is properly enabled.
    Is there a fix?

    Yes, I was using a "No banner" preset here at home, too. Not exactly sure why.
    Printing using "Standard" then setting two-sided worked.
    Exiting Preview then using "Last Used Settings" also resulted in duplex printing.
    I wonder if this has something to do with a printer preset being migrated from a 10.4 account or something....
    Since deleting that preset, I haven't been able to get it to fail either. Even creating new presets, selecting it, then adding duplex.

  • Email with attachments QPAC: setting "From" using process data doesn't work

    Hi,
    I trying to set the "From" in the Email with attachments QPAC from a process variable, let's call it "mailagent", which is of type xs:string.
    So I use a set value QPAC, which sets the "mailagent" variable to "[email protected]". The workflow then continous with the Email QPAC.
    Which stalls and throws the following exception:
    javax.mail.MessagingException: 501 Syntax error, parameters in command "MAIL FROM:<{$/process_data/@mailagent$}>" unrecognized or missing
    Hrm. I thought, I had already used the Email QPAC this way.
    Is there some kind of magic to apply to the Email with attachments QPAC in order for it to accept process data in the "From"?
    Steve

    Yes, I'm sure, it worked for us to. But it obviously no longer does.
    Yes, "mailagent" definitely is a variable of type string, though it's of type
    xs:string. I'm no longer able to create variables, which don't feature the
    xs namespace. Which is quite confusing as I've got absolutely no idea, what the
    xs is used for.
    We are using LiveCycle Workflow 7.2.1, the Email QPAC is 7.0.2. Is this the latest version?
    Steve

  • After setting the reverse proxy, SSO doesn't work

    Hi,
    We are facing a problem after setting a reverse proxy. ITS&SSO is working fine for internal users but the problem is with the external users;ITS is working fine for external users but SSO is not working. Does anyone can help us out with this problem ? It is kind of urgent.
    Thanks
    Serkan

    Eric,
    Sorry for misunderstanding,
    The domain for internal/external users are the same https://external.global.rexam.<b>net</b>/irj/portal
            internal.global.rexam.net/irj/portal
    But the ITS goes through:
    bca.rexam.<b>com</b>

  • Setting cookies in a webservice doesn't work

    I am using a ColdFusion component to publish a web service
    and I want that web service to set a cookie. However, this does not
    appear to always work.
    Specifically, if I invoke the web service from the browser by
    entering a URL such as "service.cfc?method=name" in the address
    bar, then the cookie is set properly. If I use <cfinvoke> the
    cookie is not set. If I use the EasySoap C++ library then the
    cookie is set if I use <cfheader> to set it, but is not set
    if I use <cfcookie>.
    Please see the attached code samples. "cookies.cfc" is the
    component used to publish the web service, "cookies.cfm" is a
    simple test programme which invokes the web service either using
    <cfinvoke> or with the web browser (the second time you
    invoke the web service you should see that the cookies were set the
    last time you invoked it, but this only happens if you invoke it
    using the browser. A simple C++ programme to invoke the web service
    (using EasySoap, which in turn uses WinInet) returns
    "Cookie.EchoLast_2=99" meaning that only cookies set using
    <cfheader> are actually being set.
    Please explain what on earth it is doing and what is the
    correct/approved way of setting cookies in a web service.
    Thanks!

    quote:
    Originally posted by:
    MartinW-2006
    Any suggestions? AM I right in presuming this is a bug?
    Start by ensuring that your function actually runs when you
    invoke it. Does anything get returned to your calling template?

  • Setting browser.cache.check_doc_frequency = 0 doesn't work

    Setting the value of property browser.cache.check_doc_frequency to 0 has no effect. After restarting my browser all items still coming from the local cache.
    btw. if I set the value to 1, it works as described [http://kb.mozillazine.org/Browser.cache.check_doc_frequency here]

    You can only make that work if you use Clear Recent History to clear the browser cache when you close Firefox.<br />
    That will make it impossible to retrieve the page from the local cache.<br />
    The above mentioned pref only seems to have effect if you visit the website and not when you restore a tab with the page.
    *Tools > Options > Privacy : History: [X] Clear history when Firefox closes > Settings
    *https://support.mozilla.org/kb/Clear+Recent+History

  • Set content type on header doesn't work on servlet filter

    I am trying the following filter:
    chain.doFilter(req, responseWrapper);
    and im trying to set the content type:
    response.SetHeader("Content-Type","text/plain");
    But it doesn't seem to set it.
    I have the wrapper as:
    private ByteArrayOutputStream     output;
         private int                              contentLength;
         private String                         contentType;
         private CharArrayWriter               myOut;
         private int                              mode;
         public JPServletResponseWrapper(HttpServletResponse response) {
              super(response);
              output = new ByteArrayOutputStream();
              this.myOut = new CharArrayWriter();
         public ServletOutputStream getOutputStream() throws IOException {
              this.setMode(2);
              return new JPServletOutputStream(output);
         public PrintWriter getWriter() throws IOException {
              this.setMode(1);
              return new PrintWriter(this.myOut);
         public byte[] getData() {
              return output.toByteArray();
         public int getContentLenght() {
              return this.contentLength;
         public void setContentLength(int len) {
              this.contentLength = len;
              super.setContentLength(len);
         public String getContentType() {
              return this.contentType;
         public void setContentType(String type) {
              this.contentType = type;
              super.setContentType(type);
         public int getMode() {
              return mode;
         public void setMode(int mode) {
              this.mode = mode;
         public String toString() {
              return myOut.toString();
    The page is being displayed as text/html and not as text/plain.
    Is there any reason?

    Hello,
    I think RowOrdinal is the problem. You can try below suggestion:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/634b3f24-b009-415d-8b45-40c11105b803/bug-in-creating-more-columns-in-sharepoint-list-filters?forum=sharepointdevelopmentlegacy
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • If I set a calendar alert it doesn't work !

    Should I expect my iPad to alert me if at the time of the alert it is in standby. Outlook will always show current and / or missed alerts when I first reactivate the application. On my iPad if I am not using it the alert seems to simply be ignored. If this is correct it's a bit rubbish.
    Any comments / advice would be welcome.

    I suspect that you clicked the remember this password in keychain when you set the password. Thus, when you attempt to open the document again in Pages, it knows it is you, checks the document password against the keychain entry, and just opens the document without a password challenge. Anyone else on a different account will be challenged for the password.

Maybe you are looking for

  • Wont download onto windows laptop

    tried save and run but nothing happens after firefox finished downloading, on windows vista home laptop.

  • Share only specific groups with users over cardDAV?

    OS X Server 3.2.2 I've successfully set up the Contacts server, but it appears that cardDAV syncing is an all-or-nothing prospect.  There appears to be no way to sync only select groups of contacts with select users or groups.  Instead, it appears yo

  • I need to change my country

    Hi, I've had a trial of creative cloud and am looking to upgrade to a complete account, however when I go to pay it says my country is the UK however I am located in Australia. Please can you help with this?

  • Release the Cancelled Billing Document -Error

    HI, I am a fico consultant and not aware of SD fully.Kindly help me by giving inputs. Original Invoice document is -900000008 cancelled invoice document is 1000000014 when i try to release the cancelled invoice document 1000000014 in VF02,it is givin

  • Can saving a form/save as option be password restricted?

    we have problems with people saving forms locally, and then using them still when they are invalid. Short of policy server, is there a script I can throw on a form to restict saving/saving as ? thanks.