[SOLVED] C/C++ beginner, unix time question

Hi
To learn C/C++ I'm trying to make a little space calculator.
First I would like to calculate the julian date of a given date. Using the Unix time this should be fairly simple.
(Ignoring calendar changes etc. for now.)
This is what I did so far:
// Setting the time manually
struct tm str_time;
time_t unix_time; // (time in seconds from 1. Jan 1970 00:00:00 GMT)
str_time.tm_year = 1970 - 1900; // (years from 1900)
str_time.tm_mon = 1 - 1; // (month starting at 0)
str_time.tm_mday = 1;
str_time.tm_hour = 00;
str_time.tm_min = 00;
str_time.tm_sec = 00;
str_time.tm_isdst = 0;
unix_time = mktime(&str_time);
printf("Given time is: %s\n", ctime(&unix_time));
printf("Unix time: %i s\n", unix_time);
ctime returns the correct given date Jan 1 00:00:00 1970.
But the unix_time is -3600.
Why is there an error of 1h/Shouldn't the unix_time be 0 ?
Is it wrong to initialize tm this very simple way ?
Last edited by rebootl (2013-05-25 16:12:33)

rebootl wrote:
Thanks. Yes that's correct.
Then I can correct it by simply doing:
int unix_time_corr = unix_time+3600;
However, mktime seems to be limited to 1900-?? or so... so eventually I'll have to find another solution for this...
This is all a bit intransparent to me.
For example when I use str_time.tm_year = 1300 - 1900; The year 1300.
unix_time is 331760832, which is wrong. That's OK cause it's outside the range of mktime (1900-..).
But then ctime returns: Fri Jan  1 12:00:00 1300, the correct year. How is this possible ?
1st of all, time_t is 'long unsigned', so your second printf()'s output is faulty. You should always compile with at least '-Wall' to detect those errors.
As to why ctime() is returning correct date. My 1st suggestion is to read the man pages carefully.
tm members are "int"s. So, they can accept negative values. ctime(t) is is equivalent to asctime(localtime(t)).
My guess is that localtime(t) internally casts t to a signed value. And then assigns correct values to tm members. If that's the case. Then what's passed to asctime() is correct.

Similar Messages

  • Hello, I have a problem. Help me to solve it. The first time I want to buy the game and asks me to answer a security question that I do not remember. Discard them please that I introduced them to

    Hello, I have a problem. Help me to solve it. The first time I want to buy the game and asks me to answer a security question that I do not remember. Discard them please that I introduced them to

    See Kappy's great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
     Cheers, Tom

  • SAP-XI Real time questions

    could you please provide me some real time questions on sap-xi,
    thank you

    1.  What are the Three types of XI Cache?  How are they used?
    2.  Where would you look to find Logical System in the SLD.
    ANS Business system wizard
    3.  What 2 Data Types are automatically created when the Namespace is saved in the Integration Repository?
    ANS. ExchangeFaultdata and Exchange log data.
    4   Which Development Object in SAP XI forms the "ROOT NODE" of an XML document when an XI message is generated?
    ANS MESSAGE TYPE
    5.  Describe the setting to "Permit Importing of SAP IDOCs or BAPI/ RFCs".  Where is this configured?
    ANS.
    6.  What are the valid types of Message Mappings?  Which is configured with the Graphical User Interface and requires no coding?
    ANS. MESSAGE MAPPING, XSLT MAPPING, ABAP MAPPING AND JAVA MAPPING, MESSAGE MAPPING REQUIRES no coding
    7.  What actions should you take if your Business System does not show when attempting to "Transfer from the SLD"?
    8. What is the relationship between Product, Product Version, Software Component and Software Component Version?  Give an example.
    ANS. PRODUCT: Represents a collection of all versions of a product . In SAP environment , a product corresponds to an SAP technical Component, eg 4.6c,4.6d,4.7
    COMPONENT: Represents a collection of all versions of a software components Examples of Software components are SAP_APPL,SAP_ABA,SAP_HR Software
    9.  Describe the Design Repository (DR) objects you created to configure a scenario.
    10.  What are the different design time components used by XI?
    11. What monitoring service does the integration server provide?
    12.  Describe the alert functionality of the runtime workbench.
    ANS Message alerting allows to set conditions for triggering Alerts. This allows notification of the correct parties for a specific classes of  errors.
    13.  In BPM, if you have async-sync bridge, does the QOS change?
    14.  What is logging/ trace? List 4 ways to enable logging/ trace?
    15.  Properties of an async message?
    16   Inbound XI message has problem, where do you look for solution?
    17.  Describe XI message format.
    18.  Describe end-to-end monitoring.  What is it?  How is it configured?  What are the different   views?
    ANS  It is a tool for monitoring end to end technical processes involving multiple components.
    to configure end to end monitoring :1. On initial screen of runtime work bench ,select configuration tab page.
    2.enter the logon data for the monitoring server.
    3.choose display.
    4.system displays the components of the correct domain and the integration server is selected as default.
    5.select the other components that you want to use and configure them as sender or receiver ,or both  depending on the component type.
    6.we can select monitorin level that we want to use for each of the selected component.
    7.Choose save configuration .
              Processes overview and the instance view are the two different views
    19. Different steps to make a Sender IDOC adapter work?
    20. JMS adapter can talk with what type of systems?  Give some examples...
    ANS Messaging systems to the integration engine
    21.What format can JDBC adapter communicate in?  Should you use native SQL?
    ANS. JDBC adapter converts data base content to XML messages and the other way around.
    22.If communications with JDBC using XML format, what are 4 actions you could do?
    ANS. SELECT, INSER, DELETE , UPDATE.
    23.  How does PCK and adapter framework engine differ?
    ANS.
    24.  Can JDBC adapter query DB tables?  Can it insert?
    ANS. Yes
    25.  JMS adapter scenario messaging system provider needs to submit what?
    26.  List some properties of receiving IDOC adapter.
    27.  JDBC/ JMS required certain steps before they can work?
    ANS vender specific JMS driver must be deployed on to the J2EE engine using SDM
            Appropriate JDBC driver must be deployed on the system
    28.  What is ALEAUDIT with respect to IDOCS?  When will they use it?
    29.  Properties of the HTTP adapter, does it use or need a sender or receiver communications channel or agreement?
    30.  What does a RFC adapter support?
    ANS sRFCs and tRFCs
    31.  Is EOIO supported by RFC?
    ANS No
    32.  What are the advantages of using a decentralized adapter engine?
    ANS.
    33.  What are the different monitoring statuses?  Where do you find them?
    ANS  Different monitoring statuses are Message Monitoring, Component monitoring , performance  Analysis and Alerting and we find this in Runtime Workbench.
    34.  What adapters are not in adapter engine? code you can type in,
    ANS HTTP and IDOC adapters are not in adapterengine and we can type code in  IDOC
    A.  Which ABAP proxy, in or outbound has Which one used classes with regards to Sync/ Async what is the method call?
    36.  With an optional node what would be the cardinality?  How do you make sure the subordinate fields get mapped?
    37.  WSDL what is it?  Where do you find it in Repository?  Is it used in Java or ABAP proxy?
    38.  XI 3.0, what are the supported mapping types?
    ANS Message mapping, ABAP mapping, JAVA mapping and XSLT mapping
    39.  What are the prerequisites for importing customer defined IDOC?
    ANS
    40.  What are the three IDOC transactions in XI?
    ANS  SM59, IDX1and IDX2.
    41.  Context object replace what?
    ANS  Xpath
    42.  Two things can make up a collaboration agreement, what are they?
    ANS Sender agreement and receiver agreement
    43.  What is a logical system, with respect to SLD?  Where would you assign it?
    ANS
    44.  What is the sender communications channel?
    ANS specify the potential senders of messages and the technical communication path
    45.  If error during inbound or outbound binding, where do you look to solve?
    46.  URI, URL and URN what are they and what are their differences?
    47.  To perform content based (logical) routing, two places it can be done.  What are the two places?
    48.  What is an integration process?  Where is it executed?  What stake?
    49.  In a message mapping you have advanced user defined function, can you test for context changes, if yes how?
    50.  What is multi-mapping?  Where is it used?  What are the advantages?
    ANS Multimappping is any mapping that involves N messages either or source or target side   Multimapping can be used in ccBPM
             1.used to map abstract interfaces
             2. Development is same as message mappings.
             3.n:1 transformation
             4.1:n transformation
             5. n:m transformation
    51.  What are the two XSLT tags, previously that could not be used in XI?
    ANS
    52.  Using a simple user defined function how can you send trace information to be monitored?
    53.  What is function "exists" in message mapping?
    ANS We can handle the error by checking whet her the source tag exists and if it does not we can pass an empty value, which generates the required target field.
    54.  What Jar file is required to perform Java Mapping?
    ANS
    55.  What is context in message mapping and how is it used?
    56.  What is remove context and splitby value?
    ANS to remove parent context of an element and spliby value is counterpart of remove context.
    57.  Where can you use user defined function?  What is its scope?
    58.  If you are building Java mapping class which class interface must it implement?
    59.  What is the scope of mapping template?
    60.  How does a Boolean function work in message mappings?
    61.  Source message occurs 3 times, target only once, what is wrong?
    62.  In simple mapping - one source results in 4 identical target messages, with regarding cardinality what is the problem?
    63.  What is a prerequisite to do ABAP mapping for a comple transformation?
    64.  What step can be inserted into an exception branch?
    ANS
    65.  How do you get an error condition to generated an alert?
    ANS
    66.  What actions can you perform in SXI_CACHE?
    67.  What is a wait step and why is it used?
    ANS It is a process flow control relavent and is used toset start time for next step
    68.  What is a block step and why is it used?
    ANS
    69.  Could multiple instances of an integration process be running at the same time?  If so, how does a message find its way to the correct instance?
    70.  Which XI objects can be used in an integration process?  Which ones from Repository?
    71.  Send message within an integration process to 8 receivers at the same time, how can you do this?
    72. What is a correlation?  What is a local correlation?
    73. What is the relationship between an integration process and business workflow?

  • Unix time to MSSQL time

    I'm creating a view whith a column (end_tyd) that has unix time value's that i want to convert to SQL DATETIME 103.
    Select
    FROM_UNIXTIME(end_tyd)
    From myTable
    Msg 195, Level 15, State 10, Line 22
    'FROM_UNIXTIME' is not a recognized built-in function name.
     

    Hi MVP_88,
    As
    FROM_UNIXTIME is a function of MySQL, there's no such a built-in function in SQL server. To convert the that column to DATETIME 103 in SQL server, you can reference the below.
    DECLARE @end_tyd INT;
    SET @end_tyd=1421629632
    SELECT CONVERT(VARCHAR(10),DATEADD(SECOND,@end_tyd,'1970-01-01'), 103) AS DATE
    /* OUTPUT
    DATE
    19/01/2015
    --In your case
    SELECT CONVERT(VARCHAR(10),DATEADD(SECOND,end_tyd,'1970-01-01'), 103) AS DATE FROM yourTable
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Unix time to standard time

    hi,
    i am writing a program to convert Unix time in the normal date. I wrote the
    following program. The Input is not converted properly to the normal date.
    It prints date without any issue but the time is not correct. As per the java docs
    about the date constructor the value should be calculated from
    01/01/1970 00:00:00 but mine one by default shows 01/01/1970 07:30:00
    I don't know from where 07:30 is coming by default.
    Looking forward for the suggestions.
    import java.io.*;
    import java.util.*;
    import java.text.*;
        public class unixTime{
            public static void main ( String [] args ) throws IOException
                int dateinsec = 0;
                   long t =  dateinsec * 1000L; 
                   SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
                   Date regDate = null;
                   regDate = new Date(t);
                   System.out.println("Formatted date is: " + formatter.format(regDate));
        }Thanks.
    Corrected thanks
    Edited by: vinee on Oct 7, 2008 2:10 AM

    vinee wrote:
    Sorry i didn't check earlier that i posted at the wrong place.
    Extremely sorry.No worries. Just don't do it again please.
    In the future, if you do post in the wrong place and want to repost the question in the right place, just go back to your original, and provide a reply that says something like "move to" + the URL of your new thread, so there's one coherent discussion and people don't duplicate each others' efforts.

  • Can somebody give some real time questions for alv report

    hi guru
    can somebody give some real time questions for alv report.
    answers also.
    regards
    subhasis.

    hi,
    The ALV is a set of function modules and classes and their methods which are added to program code. Developers can use the functionality of the ALV in creating new reports,  saving time which might otherwise have been spent on report enhancement
    The common features of report are column    alignment, sorting, filtering, subtotals, totals etc. <b>To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).</b>
    Using ALV, we can have three types of reports:
       1. Simple Report
       2. Block Report
       3. Hierarchical Sequential Report
    <b>Reward useful points</b>
    Siva

  • How to convert a numeric field representing UNIX time to a standard report

    Looking for some help on the creation of a formula that will allow me to convert a numeric string which represent Unix time to a standard date format.
    Sample string value "1199149200", Jan 1 2008, 1 AM

    Hi,
    Use the DateAdd formula convert Unix epoch to normal datetime (Unix epoch = number of seconds that have elapsed since January 1, 1970).
    DateAdd("s", 1199149200, datetime("01/01/1970 00:00:00"))
    Cheers,
    Fritz

  • Abap-hr real time questions

    hi friends
    kindly send me ABAP-HR REAL TIME QUESTION to my mail [email protected]
    Thanks&Regards
    babasish

    Hi
    Logical database
    A logical database is a special ABAP/4 program which combines the contents of certain database tables. Using logical databases facilitates the process of reading database tables.
    HR Logical Database is PNP
    Main Functions of the logical database PNP:
    Standard Selection screen
    Data Retrieval
    Authorization check 
    To use logical database PNP in your program, specify in your program attributes.
    Standard Selection Screen
    Date selection
    Date selection delimits the time period for which data is evaluated. GET PERNR retrieves all records of the relevant infotypes from the database.  When you enter a date selection period, the PROVIDE loop retrieves the infotype records whose validity period overlaps with at least one day of this period.
    Person selection
    Person selection is the 'true' selection of choosing a group of employees for whom the report is to run.
    Sorting Data
    · The standard sort sequence lists personnel numbers in ascending order.
    · SORT function allows you to sort the report data otherwise. All the sorting fields are from infotype 0001.
    Report Class
    · You can suppress input fields which are not used on the selection screen by assigning a report class to your program.
    · If SAP standard delivered report classes do not satisfy your requirements, you can create your own report class through the IMG.
    Data Retrieval from LDB
    1. Create data structures for infotypes.
        INFOTYPES: 0001, "ORG ASSIGNMENT
                            0002, "PERSONAL DATA
                            0008. "BASIC PAY
    2. Fill data structures with the infotype records.
        Start-of-selection.
             GET PERNR.
        End-0f-selection. 
        Read Master Data
    Infotype structures (after GET PERNR) are internal tables loaded with data.
    The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.
              GET PERNR.
                 PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
                        If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. endif.
                 ENDPROVIDE.
    Period-Related Data
    All infotype records are time stamped.
    IT0006 (Address infotype)
    01/01/1990   12/31/9999  present
              Which record to be read depends on the date selection period specified on the
              selection screen. PN/BEGDA PN/ENDDA.
    Current Data
    IT0006 Address  -  01/01/1990 12/31/9999   present
    RP-PROVIDE-FROM-LAST retrieves the record which is valid in the data selection period.
    For example, pn/begda = '19990931'    pn/endda = '99991231'
    IT0006 subtype 1 is resident address
    RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.
    Process Infotypes
    RMAC Modules - RMAC module as referred to Macro, is a special construct of ABAP/4 codes. Normally, the program code of these modules is stored in table 'TRMAC'. The table key combines the program code under a given name. It can also be defined in programs.The RMAC defined in the TRMAC can be used in all Reports. When an RMAC is changed, the report has to be regenerated manually to reflect the change.
    Reading Infotypes - by using RMAC (macro) RP-READ-INFOTYPE
              REPORT ZHR00001.
              INFOTYPE: 0002.
              PARAMETERS: PERNR LIKE P0002-PERNR.
              RP-READ-INFOTYPE PERNR 0002 P0002 .
              PROVIDE * FROM P0002
                  if ... then ...endif.
              ENDPROVIDE.
    Changing Infotypes - by using RMAC (macro) RP-READ-INFOTYPE. 
    · Three steps are involved in changing infotypes:
    1. Select the infotype records to be changed;
    2. Make the required changes and store the records in an alternative table;
    3. Save this table to the database;
    The RP-UPDATE macro updates the database. The parameters of this macro are the OLD internal table containing the unchanged records and the NEW internal table containing the changed records. You cannot create or delete data. Only modification is possible.
    INFOTYPES: Pnnnn NAME OLD,
    Pnnnn NAME NEW.
    GET PERNR.
        PROVIDE * FROM OLD
               WHERE .... = ... "Change old record
               *Save old record in alternate table
               NEW = OLD.
        ENDPROVIDE.
        RP-UPDATE OLD NEW. "Update changed record
    Infotype with repeat structures
    · How to identify repeat structures.
    a. On infotype entry screen, data is entered in table form.
        IT0005, IT0008, IT0041, etc.
    b. In the infotype structure, fields are grouped by the same name followed by sequence number.
        P0005-UARnn P0005-UANnn P0005-UBEnn
        P0005-UENnn P0005-UABnn
    Repeat Structures
    · Data is entered on the infotype screen in table format but stored on the database in a linear  
      structure.
    · Each row of the table is stored in the same record on the database.
    · When evaluating a repeat structure, you must define the starting point, the increment and the
      work area which contains the complete field group definition.
    Repeat Structures Evaluation (I)
    · To evaluate the repeat structures
       a. Define work area.
           The work area is a field string. Its structure is identical to that of the field group.
       b. Use a DO LOOP to divide the repeat structure into segments and make it available for  
           processing in the work area, one field group (block) at a time.
    Repeat Structures Evaluation(II)
    Define work area
    DATA: BEGIN OF VACATION,
                  UAR LIKE P0005-UAR01, "Leave type
                  UAN LIKE P0005-UAN01, "Leave entitlement
                  UBE LIKE P0005-UBE01, "Start date
                  UEN LIKE P0005-UEN01, "End date
                  UAB LIKE P0005-UAB01, "Leave accounted
               END OF VACATION.
    GET PERNR.
         RP-PROVIDE-FROM-LAST P0005 SPACE PN/BEGDA PN/ENDDA.
         DO 6 TIMES VARYING VACATION
                 FROM P0005-UAR01 "Starting point
                     NEXT P0005-UAR02. "Increment
                 If p0005-xyz then ... endif.
          ENDDO.
    Processing 'Time Data'.
    · Dependence of time data on validity period
    · Importing time data
    · Processing time data using internal tables
    Time Data and Validity Period
    · Time data always applies to a specific validity period.
    · The validity periods of different types of time data are not always the same as the date selection period specified in the selection screen.
    Date selection period |----
    |
    Leave |----
    |
    · PROVIDE in this case is therefore not used for time infotypes.
    Importing Time Data
    · GET PERNR reads all time infotypes from the lowest to highest system data, not only those within the date selection period.
    · To prevent memory overload, add MODE N to the infotype declaration. This prevents the logical database from importing all data into infotype tables at GET PERNR.
    · Use macro RP-READ-ALL-TIME-ITY to fill infotype table.
    INFOTYPES: 2001 MODE N.
    GET PERNR.
        RP-READ-ALL-TIME-ITY PN/BEGDA PN/ENDDA.
        LOOP AT P0021.
             If P0021-XYZ = ' '. A=B. Endif.
        ENDLOOP.
    Processing Time Data
    · Once data is imported into infotype tables, you can use an internal table to process the interested data.
    DATA: BEGIN OF ITAB OCCURS 0,
                  BUKRS LIKE P0001-BUKRS, "COMPANY
                  WERKS LIKE P0001-WERKS, "PERSONNEL AREA
                  AWART LIKE P2001-AWART, "ABS./ATTEND. TYPE
                  ASWTG LIKE P2001-ASWTG, "ABS./ATTEND. DAYS
               END OF ITAB.
    GET PERNR.
    RP-PROVIDE-FROM-LAST P0001 SAPCE PN/BEGDA PN/ENDDA.
    CLEAR ITAB.
    ITAB-BUKRS = P0001-BURKS. ITAB-WERKS = P0001-WERKS.
    RP-READ-ALL-TIME-ITY PN/BEGDA PN/ENDDA.
    LOOP AT P2001.
          ITAB-AWART = P2001-AWART. ITAB-ASWTG = P2001-ASWTG.
          COLLECT ITAB. (OR: APPEND ITAB.)
    ENDLOOP.
    Database Tables in HR
    ·  Personnel Administration (PA) - master and time data infotype tables (transparent tables).
       PAnnnn: e.g. PA0001 for infotype 0001
    ·  Personnel Development (PD) - Org Unit, Job, Position, etc. (transparent tables).
       HRPnnnn: e.g. HRP1000 for infotype 1000
    ·  Time/Travel expense/Payroll/Applicant Tracking data/HR work areas/Documents (cluster  
       PCLn: e.g. PCL2 for time/payroll results.
    Cluster Table
    · Cluster tables combine the data from several tables with identical (or almost identical) keys
      into one physical record on the database.
    . Data is written to a database in compressed form.
    · Retrieval of data is very fast if the primary key is known.
    · Cluster tables are defined in the data dictionary as transparent tables.
    · External programs can NOT interpret the data in a cluster table.
    · Special language elements EXPORT TO DATABASE, IMPORT TO DATABASE and DELETE
      FROM DATABASE are used to process data in the cluster tables.
    PCL1 - Database for HR work area;
    PCL2 - Accounting Results (time, travel expense and payroll);
    PCL3 - Applicant tracking data;
    PCL4 - Documents, Payroll year-end Tax data
    Database Tables PCLn
    · PCLn database tables are divided into subareas known as data clusters.
    · Data Clusters are identified by a two-character code. e.g RU for US payroll result, B2 for
      time evaluation result...
    · Each HR subarea has its own cluster.
    · Each subarea has its own key.
    Database Table PCL1
    · The database table PCL1 contains the following data areas:
      B1 time events/PDC
      G1 group incentive wages
      L1 individual incentive wages
      PC personal calendar
      TE travel expenses/payroll results
      TS travel expenses/master data
      TX infotype texts
      ZI PDC interface -> cost account
    Database Table PCL2
    · The database table PCL2 contains the following data areas:
      B2 time accounting results
      CD cluster directory of the CD manager
      PS generated schemas
      PT texts for generated schemas
      RX payroll accounting results/international
      Rn payroll accounting results/country-specific ( n = HR country indicator )
      ZL personal work schedule
    Database Table PCL3
    · The database table PCL3 contains the following data areas:
      AP action log / time schedule
      TY texts for applicant data infotypes
    Data Management of PCLn
    · The ABAP commands IMPORT and EXPORT are used for management of read/write to
      database tables PCLn.
    · A unique key has to be used when reading data from or writing data to the PCLn.
      Field Name KEY Length Text
      MANDT X 3 Client
      RELID X 2 Relation ID (RU,B2..)
      SRTFD X 40 Work Area Key
      SRTF2 X 4 Sort key for dup. key
    Cluster Definition
    · The data definition of a work area for PCLn is specified in separate programs which comply  
       with fixed naming conventions.
    · They are defined as INCLUDE programs (RPCnxxy0). The following naming convention applies:
       n = 1 or 2 (PCL1 or PCL2)
       xx = Relation ID (e.g. RX)
       y = 0 for international clusters or country indicator (T500L) for different country cluster
    Exporting Data (I)
    · The EXPORT command causes one or more 'xy' KEY data objects to be written to cluster xy.
    · The cluster definition is integrated with the INCLUDE statement.
    REPORT ZHREXPRT.
    TABLES: PCLn.
    INCLUDE: RPCnxxy0. "Cluster definition
    Fill cluster KEY
    xy-key-field = .
    Fill data object
    Export record
    EXPORT TABLE1 TO DATABASE PCLn(xy) ID xy-KEY.
       IF SY-SUBRC EQ 0.
           WRITE: / 'Update successful'.
       ENDIF.
    Exporting Data (II)
    . Export data using macro RP-EXP-Cn-xy.
    · When data records are exported using macro, they are not written to the database but to a  
      main memory buffer.
    · To save data, use the PREPARE_UPDATE routine with the USING parameter 'V'.
    REPORT ZHREXPRT.
    *Buffer definition
    INCLUDE RPPPXD00. INCLUDE RPPPXM00. "Buffer management
    DATA: BEGIN OF COMMON PART 'BUFFER'.
    INCLUDE RPPPXD10.
    DATA: END OF COMMON PART 'BUFFER'.
    RP-EXP-Cn-xy.
    IF SY-SUBRC EQ 0.
        PERFORM PREPARE_UPDATE USING 'V'..
    ENDIF.
    Importing Data (I)
    · The IMPORT command causes data objects with the specified key values to be read from
       PCLn.
    · If the import is successful, SY-SUBRC is 0; if not, it is 4.
    REPORT RPIMPORT.
    TABLES: PCLn.
    INCLUDE RPCnxxy0. "Cluster definition
    Fill cluster Key
    Import record
    IMPORT TABLE1 FROM DATABASE PCLn(xy) ID xy-KEY.
       IF SY-SUBRC EQ 0.
    Display data object
       ENDIF.
    Importing data (II)
    · Import data using macro RP-IMP-Cn-xy.
    · Check return code SY-SUBRC. If 0, it is successful. If 4, error.
    · Need include buffer management routines RPPPXM00
    REPORT RPIMPORT.
    *Buffer definition
    INCLUDE RPPPXD00.
    DATA: BEGIN OF COMMON PART 'BUFFER'.
    INCLUDE RPPPXD10.
    DATA: END OF COMMON PART 'BUFFER'.
    *import data to buffer
    RP-IMP-Cn-xy.
    *Buffer management routines
    INCLUDE RPPPXM00.
    Cluster Authorization
    · Simple EXPORT/IMPORT statement does not check for cluster authorization.
    · Use EXPORT/IMPORT via buffer, the buffer management routines check for cluster
      authorization.
    Payroll Results (I)
    · Payroll results are stored in cluster Rn of PCL2 as field string and internal tables.
      n - country identifier.
    · Standard reports read the results from cluster Rn. Report RPCLSTRn lists all payroll results;
      report RPCEDTn0 lists the results on a payroll form.
    Payroll Results (II)
    · The cluster definition of payroll results is stored in two INLCUDE reports:
      include: rpc2rx09. "Definition Cluster Ru (I)
      include: rpc2ruu0. "Definition Cluster Ru (II)
    The first INCLUDE defines the country-independent part; The second INCLUDE defines the country-specific part (US).
    · The cluster key is stored in the field string RX-KEY.
    Payroll Results (III)
    · All the field string and internal tables stored in PCL2 are defined in the ABAP/4 dictionary. This
      allows you to use the same structures in different definitions and nonetheless maintain data
      consistency.
    · The structures for cluster definition comply with the name convention PCnnn. Unfortunately, 
       'nnn' can be any set of alphanumeric characters.
    *Key definition
    DATA: BEGIN OF RX-KEY.
         INCLUDE STRUCTURE PC200.
    DATA: END OF RX-KEY.
    *Payroll directory
    DATA: BEGIN OF RGDIR OCCURS 100.
         INCLUDE STRUCTURE PC261.
    DATA: END OF RGDIR.
    Payroll Cluster Directory
    · To read payroll results, you need two keys: pernr and seqno
    . You can get SEQNO by importing the cluster directory (CD) first.
    REPORT ZHRIMPRT.
    TABLES: PERNR, PCL1, PCL2.
    INLCUDE: rpc2cd09. "definition cluster CD
    PARAMETERS: PERSON LIKE PERNR-PERNR.
    RP-INIT-BUFFER.
    *Import cluster Directory
       CD-KEY-PERNR = PERNR-PERNR.
    RP-IMP-C2-CU.
       CHECK SY-SUBRC = 0.
    LOOP AT RGDIR.
       RX-KEY-PERNR = PERSON.
       UNPACK RGDIR-SEQNR TO RX-KEY-SEQNO.
       *Import data from PCL2
       RP-IMP-C2-RU.
       INLCUDE: RPPPXM00. "PCL1/PCL2 BUFFER HANDLING
    Function Module (I)
      CD_EVALUATION_PERIODS
    · After importing the payroll directory, which record to read is up to the programmer.
    · Each payroll result has a status.
      'P' - previous result
      'A' - current (actual) result
      'O' - old result
    · Function module CD_EVALUATION_PERIODS will restore the payroll result status for a period
       when that payroll is initially run. It also will select all the relevant periods to be evaluated.
    Function Module (II)
    CD_EVALUATION_PERIODS
    call function 'CD_EVALUATION_PERIODS'
         exporting
              bonus_date = ref_periods-bondt
              inper_modif = pn-permo
              inper = ref_periods-inper
              pay_type = ref_periods-payty
              pay_ident = ref_periods-payid
         tables
              rgdir = rgdir
              evpdir = evp
              iabkrs = pnpabkrs
         exceptions
              no_record_found = 1.
    Authorization Check
       Authorization for Persons
    ·  In the authorization check for persons, the system determines whether the user has the 
       authorizations required for the organizational features of the employees selected with
       GET PERNR.
    ·  Employees for which the user has no authorization are skipped and appear in a list at the end
       of the report.
    ·  Authorization object: 'HR: Master data'
    Authorization for Data
    · In the authorization check for data, the system determines whether the user is authorized to
      read the infotypes specified in the report.
    · If the authorization for a particular infotype is missing, the evaluation is terminated and an error
      message is displayed.
    Deactivating the Authorization Check
    · In certain reports, it may be useful to deactivate the authorization check in order to improve
      performance. (e.g. when running payroll)
    · You can store this information in the object 'HR: Reporting'.
    these are the main areas they ask q?

  • Convert Epoch (UNIX) time to a readable timestamp

    Post Author: uberwolfe
    CA Forum: Formula
    I am pulling data from a MS SQL 2000 database (for you phone phreaks out there, I am going against the Cisco CallManager CDR database).  The datetime stamp is in there as UNIX time.  I need to convert and split this into two fields, a date field and a time field.  As I have inherited this and don't know a lot about Crystal Reports I am at a loss.  Currently the report I have (that a developer who is no longer with us wrote) has two formula's.  The formulas are as follows: Time:CTime ({vw_OCESelectionDetail.dateTimeConnect}/8640025569) Date:CDate ({vw_OCESelectionDetail.dateTimeConnect}/8640025569) When the time is returned, it looks to be in GMT.  What type of formula would I need to have to convert the time to the correct time within the timezone I am in.  Any help would be appreciated.  

    Post Author: uberwolfe
    CA Forum: Formula
    Gave me an error stating the year needed to be between 1 and 9999.  I modified it as such CTime (({vw_OCESelectionDetail.dateTimeConnect} - 21600) / 86400 + 25569)
    CDate (({vw_OCESelectionDetail.dateTimeConnect} - 21600) / 86400 + 25569)  Running it right now, but it takes a while.  Let's see what happens.  Will post in a bit. 

  • Time required in Unix time stamp format

    Hello ,
    I am new to java as I have recently started working on it.
    My requirement is to get current system date in Unix format which is integer(32 bit value) .Is there any class in java which will allow me to do this operation.
    Regards
    Vijay

    System.currentTimeMillis() returns a long (64bit integer) containing the number of milliseconds since Jan 01 1970. The UNIX time format is the number of seconds since Jan 01 1970, so all you need to do is get the time using System.currentTimeMillis(), divide by 1000, and cast it to an int (32 bit integer).

  • Convert unix time stamp to readable time with daylight saving

    Hello NG,
    I have a table that has a column containing time stamps in the unix time format (seconds since 1970). If I show these times to the user, they should be converted to some readable format. I'm using the following sql code as an example:
    select to_char(
    to_timestamp_tz(
    to_char(
    to_date('01011970','ddmmyyyy') + 1/24/60/60 * 1086508800,
    'YYYY-MM-DD HH24:MI:SS')||' Europe/Warsaw',
    'YYYY-MM-DD HH24:MI:SS TZR'),
    'YYYY-MM-DD HH24:MI:SS TZH:TZM')
    from dual;
    The output I get is the following:
    TO_CHAR(TO_TIMESTAMP_TZ(TO
    2004-06-06 08:00:00 +02:00
    The output is right, but the format I need is the following:
    2004-06-06 10:00:00
    How do I have to alter the statement to get the correct result (add the two hours of the timezone and dst to the time)?
    Any help is appreciated.
    Regards,
    Mario Freimann

    That's the strange thin ... this timezone doesn't exist.
    Running the query I get the error message
    ORA-01882: timezone-region not found
    The results of the statement
    select * from V$TIMEZONE_NAMES;
    for Europe are:
    TZNAME TZABBREV
    Europe/Dublin LMT
    Europe/Dublin DMT
    Europe/Dublin IST
    Europe/Dublin GMT
    Europe/Dublin BST
    Europe/Istanbul LMT
    Europe/Istanbul IMT
    Europe/Istanbul EET
    Europe/Istanbul EEST
    Europe/Istanbul TRST
    Europe/Istanbul TRT
    Europe/Lisbon LMT
    Europe/Lisbon WET
    Europe/Lisbon WEST
    Europe/Lisbon WEMT
    Europe/Lisbon CET
    Europe/Lisbon CEST
    Europe/London LMT
    Europe/London GMT
    Europe/London BST
    Europe/London BDST
    Europe/Moscow LMT
    Europe/Moscow MMT
    Europe/Moscow MST
    Europe/Moscow MDST
    Europe/Moscow S
    Europe/Moscow MSD
    Europe/Moscow MSK
    Europe/Moscow EET
    Europe/Moscow EEST
    Europe/Warsaw LMT
    Europe/Warsaw WMT
    Europe/Warsaw CET
    Europe/Warsaw CEST
    Europe/Warsaw EET
    Possibly something is not right with my installation (Oracle 9.2.0.1.0) ...

  • Unix Time Stamp to Date for display

    Post Author: merph
    CA Forum: Formula
    I need to convert a unix time stamp to a readable date for a report. Does anyone outthere have a good formula for this?
    Thanks
    Merph

    Post Author: V361
    CA Forum: Formula
    If you can pull a couple of unix epoch times from the database, then let's run these formulae against them and see if it brings up the correct date and time separately.  These formula are pulled from another post by UberWolfe.
    ctime(( - 18000) / 86400+25569)
    cdate(( - 18000) / 86400+25569)
    The 18000 is for to convert for timezones for example 18000 is for     -5 GMT.

  • Conversion of Unix time to GMT

    Does anyone know of a way in which I can turn a date in unix time (no. of seconds since 1st Jan 1970) into a standard GMT format?
    Any help would be greatly appreciated.
    Thanks!

    To use GMT time, use TimeZone:
    * UnixTime.java
    * Created on February 16, 2006, 11:20 AM
    * @author Charles Li
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    import java.util.TimeZone;
    public class UnixTime {
        public static void main(String[] args) {
            GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("GMT+0"));
            long unixTime = 1234567890L; // unix time is second
            long ONE_SECOND = 1000L; // 1 second = 1000 millisecond
            gc.setTimeInMillis(unixTime*ONE_SECOND);
            // 2009/2/13
            System.out.println("Year: " + gc.get(Calendar.YEAR));
            System.out.println("Month: " + (gc.get(Calendar.MONTH)+1));
            System.out.println("Day: " + gc.get(Calendar.DAY_OF_MONTH));
    }

  • Need SAP-HR Module wise Blue prints and Real time questions

    Hi HR Team,
                    can u send me the OM issues and real time questions and any HR module Questions and Blue prints .pls if useful awarded points
    my mail id is [email protected]

    Hi HR Team,
                    can u send me the OM issues and real time questions and any HR module Questions and Blue prints .pls if useful awarded points
    my mail id is [email protected]

  • Somer real time questions

    hi experts,
    1. how to call 2 transactions in same BDC program at a time, like 'mk01' and 'va01'.
    2. what is the transaction to create barcode.
    3. how to debug a smartform.
    4. in which table session are stored.
    ALSO CAN ANY ONE SEND ME SOME REAL TIME QUESTIONS ASKED IN INTERVIEW
    thankx

    2a.) SE73 is the transaction to create barcodes..
    se73 --> System Barcodes --> create ur new barcode
    then go to t-code: SMARTSTYLES there u have to create characterformat for the barcode u have created.
    and use this characterformat in smartforms or sapscripts editor ...
    3a.) Use breakpoint in program or i think with /h it activates the debugging of smartform or sapscript.
    4a.) in table APQI all session records r stored.
    reward if it helps

Maybe you are looking for